Thứ Tư, 1 tháng 4, 2015

How to Clear & Flush DNS Cache on iPhone & iPad

How to flush DNS cache in iOS If you ever need to set custom DNS or change the DNS settings on iOS devices for using an alternate domain name server or a faster one, you’ll probably want the DNS changes to take effect immediately, which requires the flushing of DNS caches on the iPhone or iPad. There are actually several ways to perform a DNS flush on an iOS device, we’ll cover the two fastest methods below, the first is preferential because it has the least amount of impact overall to other activity on the device as it does not require a reboot.

Keep in mind these methods work the same for all iPhone, iPad, and iPod touch devices, though the Airplane Mode approach works particularly well with iPhone and cellular equipped iPad devices.

Flush DNS Cache on iPhone / iPad with AirPlane Mode Toggle

By far the simplest way to clear out the DNS caches on the iPhone is to simply toggle Airplane mode ON and back OFF again. This is easily done by using the simple airplane switch from within the Control Center of modern versions of iOS:

  1. Swipe up from the bottom of the iPhone screen to reveal Control Center
  2. Tap on the Airplane Icon to enable Airplane Mode – wait until the devices radio signals are off as indicated by the airplane logo in the status bar, then tap again on the Airplane Icon to disable Airplane Mode
  3. Swipe down to leave Control Center, the DNS cache has been flushed successfully

Flush DNS cache on iPhone by toggling Airplane mode on and off again

Now that DNS has been cleared out, whatever adjustments were made in the devices Network Settings will take effect immediately without any further action.

Rarely, the Airplane Mode toggle does not work sufficiently to clear out some persistent DNS caches, though it always should, perhaps it’s a bug in the unusual scenarios where it does not work sufficiently. If that’s the case, you have another option to clear out the caches, which we’ll cover next.

Clearing Persistent DNS Cache from iOS with a Network Settings Dump

Resetting the iOS devices network settings is a surefire way to flush all old DNS settings if you made adjustments and for some reason or another they were not maintained. The downside to this is that you’ll lose connections to wi-fi routers and other specific network settings. Additionally, this reboots the device, which is actually another way to clear DNS cache anyway.

  1. Open the “Settings” app in iOS and head to “General” followed by “Reset”
  2. Choose “Reset Network Settings” and confirm that you wish to clear out all network settings (though no specified, this includes all DNS data)
  3. When the device reboots, the DNS cache will be cleared out but so will all other customizations, meaning you’d need to set a manual change made to DNS servers again

Reset Network Settings in iOS

This latter approach is rarely necessary, and though it’s not as simple as the AirPlane switch or the Mac command line approach offered to flush DNS details in new versions of OS X, it does work if all else fails.

That should be all that is necessary to clear out stale DNS cache from your iOS devices. Keep in mind that sometimes your local device DNS settings are not going to make a difference if what you’re waiting for is DNS propagation changes from elsewhere around the internet, which can take quite a while for DNS changes to carry over between servers around the world.

If you know of another way of modifying or clearing DNS cache in iOS, let us know in the comments.

Source : osxdaily[dot]com
post from sitemap

Thứ Ba, 31 tháng 3, 2015

iPhone 6C Rear Shell Leaked

iPhone-6c-Leaked-Flash

Today, an interesting leak appeared for the new cheaper iPhone model the iPhone 6C. While it is only a shell, the leak helps solidify the rumor that Apple will be releasing three new iPhone’s this year.  The images originated at future suppliers website and show the difference between the existing model and the prototype.

On the front you can tell that the camera flash cut out is no longer round and now more oblong. This could indicate that the iPhone 6C will have a two tone flash, however, the currently used two tone flash in the iPhone 6 is circular.

On the back you will notice that the speaker and microphone grills have changed. They both appear to have two rows instead of one.

iPhone-6c-Leaked-Speaker

Source : jailbreaknation[dot]com
post from sitemap

Thứ Hai, 30 tháng 3, 2015

Creating Your Own Custom Controls Using IBDesignable in Xcode 6

34 Flares 34 Flares ×

Have you tried to create a custom control in older versions of Xcode? It’s not that easy. What makes it so hard is that you couldn’t see your design in the Interface Builder. Every time you want to review the design changes, you can only test the control in the simulator. That’s troublesome. You would probably need to spend hours and hours on designing a single component.

With the release of Xcode 6, Apple introduced a new feature known as IBDesignable and IBInspectable for developers to build custom controls and allowed us to live preview the design right in the Interface Builder. Quite obviously, this is a huge productivity benefit.

In this tutorial, I will give you an introduction to IBDesignable and IBInspectable, and show you guys how to take advantage of the new feature. There is no better way to elaborate a feature than creating a demo. So we will build a custom interface called “Rainbow” together.

Rainbow

IBDesignable and IBInspectable

With IBDesignable and IBInspectable, developers are allowed to create interface (or view) that renders in Interface Builder in real time. In general, to apply this new feature, all you need to do is create a visual class by subclassing UIView or UIControl and then prefix the class name with @IBDesignable keyword in Swift. If you are using Objective-C, you use IB_DESIGNABLE macro instead. Here is a sample code in Swift:

1
2
3
@IBDesignable
class Rainbow: UIView {
}

In older versions of Xcode, you can edit the user-defined runtime attributes to change properties of an object (e.g. layer.cornerRadius) in Interface Builder. The problem is you have to key in the exact name of the properties. IBInspectable takes a step forward. When you prefix a property of the visual class with IBInspectable, the property will be exposed to the Interface Builder such that you can change its value in a much straightforward way:

Custom IBDesignable Control

Again if you are developing your app in Swift, what you have to do is just prefix your chosen property with the keyword @IBInspectable. Here is a sample code snippet:

1
2
3
 @IBInspectable var firstColor: UIColor = UIColor.blackColor() {
     // Update your UI when value changes
 }

Getting confused? No worries. You will understand what I mean after going through the project demo.

Building Your Xcode Project

Let’s get started by creating a new project in Xcode and choose Single View Application as a template, and name it RainbowDemo. We will use Swift in this project as the programming language, so don’t forget to choose it when creating the project.

Once finished, select the Main.storyboard in the Project Navigator and drag a View object from the Object Library to the View Controller. Change its color to #38334C (or whatever color you want) as well as set its size to 600 by 434. Then put it in the center of the main view. Don’t forget to change the color of the main view to the same color of the view object.

Tip: If you want to change the RGB Color values for your code, just open up your Color Palette and switch to the Sliders tab to alter the RGB values.
Demo1

With Xcode 6, you have to configure auto layout constraints for the view in order to support all types of iOS devices. Auto Layout is pretty powerful in the latest version of Xcode. For simple constraints, you can just click the Issues option of the Auto Layout menu and choose “Add Missing Contraints”, and Xcode will automatically configure the layout constraints for the view.

Demo2

Creating Custom View Class

Now that you’ve created the view in storyboard, it’s time to create our custom view class. We’ll use the Swift class template for the class creation. Name it “Rainbow”.

swift-class-template

Then insert the following code in the class:

1
2
3
4
5
6
7
8
9
10
11
import UIKit

class Rainbow: UIView {
    required init(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
   
    override init(frame: CGRect) {
        super.init(frame: frame)
    }
}

As mentioned before, the visual class is a subclass of UIView. In order to use our custom class in live rendering, we need to override both initializers as shown above. Next split the view by selecting the assistant editor:

assistant-editor

Once done, select the main storyboard in the assistant editor, so you can see what you are building in real time. Remember to change the class name of the view to “Rainbow” under the Identity inspector:

IBDesignable Demo App

Implementing IBDesignable Controls

The first step to enable a control for live rendering is to set the custom view as Designable by prefixing the class name with @IBDesignable:

1
2
3
4
@IBDesignable
class Rainbow: UIView {
    ...
}

It’s kinda simple as you can see. But this simple keyword would make your development much easier. Next, we will add a few properties for setting the colors of the circles. Insert these lines of code in the Rainbow class:

1
2
3
@IBInspectable var firstColor: UIColor = UIColor(red: (37.0/255.0), green: (252.0/255), blue: (244.0/255.0), alpha: 1.0)
@IBInspectable var secondColor: UIColor = UIColor(red: (171.0/255.0), green: (250.0/255), blue: (81.0/255.0), alpha: 1.0)
@IBInspectable var thirdColor: UIColor = UIColor(red: (238.0/255.0), green: (32.0/255), blue: (53.0/255.0), alpha: 1.0)

Here, we predefine each property with a default colour, and tell it to redraw the view each time a user changes its value. Most importantly, we prefix each property with the @IBInspectable keyword. If you go to the Attributes inspectable of the view, you should find these properties visually:

color-pickers

Cool, right? By indicating the properties as IBInspectable, you can edit them visually using color picker.

Okay let’s move to implement the main methods of the Rainbow class, which is used to draw a circle on the screen. Insert the following method in the class:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
func addOval(lineWidth: CGFloat, path: CGPathRef, strokeStart: CGFloat, strokeEnd: CGFloat, strokeColor: UIColor, fillColor: UIColor, shadowRadius: CGFloat, shadowOpacity: Float, shadowOffsset: CGSize) {
   
    let arc = CAShapeLayer()
    arc.lineWidth = lineWidth
    arc.path = path
    arc.strokeStart = strokeStart
    arc.strokeEnd = strokeEnd
    arc.strokeColor = strokeColor.CGColor
    arc.fillColor = fillColor.CGColor
    arc.shadowColor = UIColor.blackColor().CGColor
    arc.shadowRadius = shadowRadius
    arc.shadowOpacity = shadowOpacity
    arc.shadowOffset = shadowOffsset
    layer.addSublayer(arc)
}

To make the code clean and readable, we create a common method for drawing a full or half circle according to the parameters provided by the caller. It’s pretty straightforward to draw a circle or an arc using CAShapeLayer class. You can control the start and end of the stoke using the strokeStart and strokeEnd properties. By varying the value of stokeEnd between 0.0 and 1.0, you can draw a full or partial circle. The rest of the properties are just used to set the color of a stroke, shadow color, etc. You can check out the official documentation for details of all the properties available in CAShapeLayer.

Next, insert the following methods in the Rainbow class:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
override func drawRect(rect: CGRect) {
    // Add ARCs
    self.addCirle(80, capRadius: 20, color: self.firstColor)
    self.addCirle(150, capRadius: 20, color: self.secondColor)
    self.addCirle(215, capRadius: 20, color: self.thirdColor)
}

func addCirle(arcRadius: CGFloat, capRadius: CGFloat, color: UIColor) {
    let X = CGRectGetMidX(self.bounds)
    let Y = CGRectGetMidY(self.bounds)
   
    // Bottom Oval
    let pathBottom = UIBezierPath(ovalInRect: CGRectMake((X - (arcRadius/2)), (Y - (arcRadius/2)), arcRadius, arcRadius)).CGPath
    self.addOval(20.0, path: pathBottom, strokeStart: 0, strokeEnd: 0.5, strokeColor: color, fillColor: UIColor.clearColor(), shadowRadius: 0, shadowOpacity: 0, shadowOffsset: CGSizeZero)
   
    // Middle Cap
    let pathMiddle = UIBezierPath(ovalInRect: CGRectMake((X - (capRadius/2)) - (arcRadius/2), (Y - (capRadius/2)), capRadius, capRadius)).CGPath
    self.addOval(0.0, path: pathMiddle, strokeStart: 0, strokeEnd: 1.0, strokeColor: color, fillColor: color, shadowRadius: 5.0, shadowOpacity: 0.5, shadowOffsset: CGSizeZero)

    // Top Oval
    let pathTop = UIBezierPath(ovalInRect: CGRectMake((X - (arcRadius/2)), (Y - (arcRadius/2)), arcRadius, arcRadius)).CGPath
    self.addOval(20.0, path: pathTop, strokeStart: 0.5, strokeEnd: 1.0, strokeColor: color, fillColor: UIColor.clearColor(), shadowRadius: 0, shadowOpacity: 0, shadowOffsset: CGSizeZero)
   
}

The default implementation of the drawRect method does nothing. In order to draw circles in the view, we override the method to implement our own drawing code. The addCircle method takes in three parameters: arcRadius, capRadius and color. The arcRadius is the radius of the circle, while the capRadius is the radius of the rounded cap.

The addCircle method makes use of UIBezierPath to draw the arcs and it works like this:

  1. First it draws a half circle at the bottom
  2. Next it draws a full small circle at the edge of the arc.
  3. Finally, it draws the other half of the circle

In the drawRect method, we call the addCircle method three times with different radius and color. This figure illustrates how the circles are drawn:

ibdesignable-circles
Tip: If you need more information about UIBezierPath, you can check out Apple’s official documentation.

With the IBInspectable properties, you are now free to change the color of each circle right in the Interface Builder without diving into the code:

Screen Shot 2015-03-15 at 2.31.40 PM

Obviously, you can further expose arcRadius as an IBInspectable property. I’ll leave it as an exercise for you.

ibdesignable-exercise

Summary

After going through this tutorial, I hope that you now understand how to use both IBDesignable and IBInspectable in Xcode 6. With the real-time preview in the Interface Builder, this new feature would allow you to create custom componenents in a more effcient way.

For your reference, you can download the complete Xcode project from here. As always, leave me comment and share your thought about the tutorial.

Source : appcoda[dot]com
post from sitemap

Thứ Sáu, 27 tháng 3, 2015

App Showcase #3: FindMoreInternships by Vin Lee

3 Flares 3 Flares ×

As you know, from time to time, we feature apps developed by our readers, in particular for those who released their very first app. Here comes to the third app showcase. This time we talked to Vin Lee, the app developer behind FindMoreInternships, an app that provides internship information for college and high school students.

Vin will share with us how he came up with the app idea, learned to code and built the app. I encourage you to check out FindMoreInternships especially you are a student. If you’re still considering whether you should learn iOS programming, I hope Vin’s story will inspire you to kick start your app development journey.

findmoreinternships

1. Tell me more about your background and your app. Was it your first app?

For the past 17 years, one way or another, I have been in IT and have been involved in everything in-between graphic design to web design to help desk to systems administration to systems engineering.

My first published app is called FindMoreInternships, and it is an extension of one of my websites, FindInternships.com. At least 95% of the internsips on FindMoreInternships, can’t be found on the website, that’s why the app has the word ‘more’ in it. The app also focuses on internships that are currently available. Once the internship deadline has passed, the internship is automatically removed from the app. Essentially the app is like an internship web browser.

findinternships

While this is my first published app via the Apple Store, I have many private apps that were either part of a tutorial or part of my own projects.

2. How did you come up with the idea? How long did it take to develop the app?

For years I have been toying with many ideas for my first published app. But it wasn’t until apple released iOS 7, that I really started to appreciate the value of table-based apps, and the possibilities in which I could make use of it. The free tabled-based tutorials on appcoda.com helped me decide that this was the direction that I wanted to go in. Eventually I realized, why not base my first app on my website.

It took about 100 hours over the course of 3 months to develop the app, and then another 50 hours in 30 days for all the updates.

3. Do you have any programming experience before developing the app? How did you learn iOS programming?

I started coding with HTML at an internship at NASA in the mid-1990’s. In college, a few years later, my major included programing, so I had to take classes like Visual Basic, C++, Java, etc. I developed a few programs in college for projects. Later I graduated with a degree in Computer Engineering, where I began my career in systems/network administration. Thanks to my internship/college background, I had many opportunities to utilize what I learned. Sometimes it was assisting web developers to isolate problems and/or implement a feature on their site. Other times, I used programing to perform a wide variety of actions on Windows servers. When Apple released the iPhone in 2007, between then and the summer of 2014, I purchased many books, watched hundreds of videos, and browsed through scores of iOS development sites, while completing personal or practice projects in between.

4. Do you use Swift or Objective-C to develop your app? (If you use Objective-C, do you have any plan to use Swift for your next release?)

My app is 99.99999% Swift. Up until the summer of 2014, everything I learned/read/practiced about developing an iOS app was in Objective-C. However, later in the fall, I decided to challenge myself to produce my first published app with Swift. I use a Parse database, so I have to use an Objective-C bridge header for the Parse framework because the frame work is in Objective-C. The reference in the header is just one line of code.

5. What are you going to do to promote your app?

Right now, I primarily use Twitter to promote the app. In the coming months, I plan to use Facebook and a few PR sites. So far the campaigns are coming along really well.

6. What were the most valuable lessons you learnt from AppCoda and its books?

I read a ton of information online and watched at least 100 hours of iOS web development videos. I also attended an iOS course at Thinkful.com. The most helpful material was AppCoda.com, the Beginning iOS 8 Programming with Swift eBook from AppCoda, and the AppCoda screencasts. Prior to the fall of 2014 I completed almost every tutorial from website, and read all the tutorials several times. When the book was released, I read the entire book and completed the tutorials as well. Some chapters I’ve read several times as well. I had forgotten about the screencasts initially, but when I remembered, I watched all those several times as well. They really help complete my understanding. I really appreciate the way the tutorials are structured. I like the available code that is always provided for the complete project. And the videos were like icing on the cake. The table based tutorials were my favorite on the website. That material helped the most with my learning. I also loved the fact that the book/screencasts walked you through an entire project. Most of the time I had no problems understanding the material, and I had very few questions. I think this was because everything was presented in a very easy to understand, step-by-step format. Honestly, I don’t think I would have a published app if it were not for AppCoda.com and the beginner’s guide, despite everything else I had used over the years.

7. Any advices for those who just started learning iOS programming?

My first advice would be to use appcoda.com first. Go through all the tutorials and get familiar with development. Second, be patient. Producing a quality app takes time, even if you have all day to work on it. Even after you complete the app, take your time with testing it and test it throughly. Third, purchase the Beginning iOS 8 Programming with Swift – Complete Package. Honestly I was a little hesitant to do this. I had already spent money at Thinkful.com and up until then, other than a book or two, everything else I was using was free. And while I valued appcoda.com, I was afraid the package would just reiterate what I already went over on their website. To my surprise it was not, and the knowledge I learned from the package really helped me finally publish my app. Fourth, table based apps are easier to create. So start there for your first app. And last, don’t give up. I started 7 years ago, and thanks to AppCoda I’m finally here. And even though I had a background in IT, I must admit this was still very challenging to me.

8. What’s your next plan?

Not sure yet. The summer application internship season is almost over. That’s usually the when things slow down. The app has already had 3 major updates since it’s release at the beginning of the year, and there are some minor updates that are needed. So I’ll probably finish those and start focusing on creating an equivalent Android app, as well as focus more on marketing the Apple app. Oh, and I will probably delve into the intermediate AppCoda book.

Are you interested in sharing your app development experience? Please leave us comment below or send us a message.

Source : appcoda[dot]com
post from sitemap

MSS Rumors: iOS 8.2 Jailbreak Coming Out In An Hour

gwOtWoA

Right now the Mobile Security Summit is taking place in Beijing where famous hackers Comex, P0sixninja, Pimskeks and Chronic will be speaking along with members of TiaG. Reddit and Twitter have gone wild with rumors of a jailbreak happening at 4pm Beijing Time which is 1 AM PST (around 40 mins after this post is published). The rumor was started over a Weibo chat with no sufficient evidence.

MMS Info

Mobile-Security-Summit-2015 (1)

Currently this rumor is on the top of r/Jailbreak on Reddit

Screen Shot 2015-03-27 at 12.15.44 AM

Source : jailbreaknation[dot]com
post from sitemap

Apple Rumored To Release an iPhone 6S, iPhone 6s Plus, and iPhone 6C

2015-iPhone-6c-and-6s-plus

Even though it is only March new rumors of the next generation phones have hit the web. According to DigiTimes Apple is planning on releasing three new phones the second half of this year.   You may have guessed the iPhone 6s and iPhone 6+ but the third one is more of a surprise. Apparently there will be an iPhone 6C featuring a 4 inch display

All of the devices will come equipped with Corning Gorilla Glass, the sources said, adding the 6S series will use A9 chips and the 6C A8 chips. All of the devices will come equipped with NFC and fingerprint scanning technologies.

As you can see on the chart below, the iPhone 6C would be quite a bit smaller than the 6S / 6S Plus granted they stay the same size. Apple would most likely do this to appeal to the market that liked the smaller phones that they used to offer or who want a phone at a cheaper price.

iphone-6-size-comparison-100437672-primary.idge

Source : jailbreaknation[dot]com
post from sitemap

See the Year a Song was Released from iTunes Radio

iTunes Radio Music The next time you’re listening to iTunes Radio and you find yourself wondering which wonderful decade a particular song came from, wonder no more, because iTunes Radio can tell you when a song was released.

You can even see the date of a songs release with songs listed in iTunes Radio history, here’s all you need to do from the Music app on your iPhone or iPad:

  1. With the song playing in iTunes Radio, tap the (i) button at the top of the Music app
  2. Locate the songs release date at the bottom

Sometimes two dates are displayed, like in the example screenshot here, which is the original release date of the song, plus the date of the re-release.

Find what year a song was released in iTunes Radio

This is generally quite accurate, though if you’re getting information about a song that is from a Best Of list or Greatest Hits album, you’ll find the release date is sometimes listed as when that album was released rather than the original song, that’s really the only potential catch.

While you’re in that settings panel you can also tune the iTunes Radio station to play hits or discovery, and to include explicit lyrics or not, that latter tip is quite helpful because excluding explicit lyrics often impacts what versions of songs are played, with the explicit toggle on you’ll be more likely to find album versions of a song playing versus a clean radio version – sometimes a single word or lyric can make that difference.

This is helpful for obvious reasons, but it’s also useful to settle the debate about what year was the greatest ever for music, or just knowing when a song was actually put out.

Source : osxdaily[dot]com
post from sitemap