iOS 8 Hour 1: Welcome App Won’t Run

Having trouble with the Hour 1 Welcome project? Please download the updated tutorial archive – posted May 6th, 2015. A change in the Swift project templates with the latest version of Xcode prevented the application from running.

Posted in Errata, iOS 8 Errata

iOS 8 All Hours: The Evolution of Swift

Teach Yourself iOS 8 in 24 Hours was written with the latest version of Xcode, and the project files were prepared with the latest beta. Unfortunately, Swift is evolving quickly. There will likely be small issues that occur in the project code as underlying changes are made. In the GPS projects, for example, you’ll see an change to the downcasting in Xcode 6.3 that requires “<blah> as! <blah>” as opposed to “<blah> as <blah>.” Xcode 6.2 (the current shipping version at the time of this writing) doesn’t require this.

If you have a difficult time with a piece of code in the book, let me know! I’ll make sure that an update is made available.

Posted in Errata, iOS 8 Errata

iOS 7 Hour 1: Welcome Project Corruption (iPhone only)

Having trouble with the Hour 1 Welcome project on the iPhone? Please download the updated tutorial archive – posted Jan 25, 2014. An error with the project file settings prevented the original release from running correctly.

Posted in Errata, iOS 7 Errata, Notes

Hour 2: Root View Controller Error

In the latest Xcode releases you will see an error regarding a missing root View Controller when running the HelloXcode application. To satisfy the requirement, simply add this line to the code provided:

self.window.rootViewController=[UIViewController new];
Posted in Errata, iOS 5 Errata, iOS 6 Errata

Hour 14: Table 14.1 Missing

Table 14.1 is referenced at the end of page 452, but isn’t included in the book. The missing table is reproduced here:

A visualization of the flowerData structure in memory.

 

Posted in iOS 5 Errata

@synthesize added automatically in Xcode 4.4+

Sick of typing a @synthesize line for every property? Install Xcode 4.4 (now available on the Mac App Store) and let Xcode do it for you!

Posted in iOS 5 Errata, Notes

Xcode 4.3+ has a new home

If you install new versions of Xcode from the App Store, you’ll notice that they no longer install under a “/Developer” directory. Xcode now lives under the main Applications directory. The Developer directory is still present, but it’s just located in the Xcode application bundle at “/Applications/Xcode.app/Contents/Developer/”.

Posted in iOS 5 Errata, Notes

Hour 13: UINavigationController Changes

In Xcode 4.3 and later, Apple has changed what happens when you add a navigation controller to your project. Instead of giving you a blank UIViewController (labeled “Root View Controller”) to do with as you please, it links you to a table view controller.  The good news is that you can still easily remove this table view controller and connect to whatever type of scene you want.

For example, in the Hour 13 “LetsNavigate” project, after adding the navigation controller, your Storyboard will look like this:

To change back to a “normal” view controller (UIViewController) in place of the table view controller (UITableViewController), follow these steps:

  1. Select the “Table View Controller – Root View Controller” line in the Document Outline.
  2. Press Delete to remove the scene.
  3. Drag a new view controller (UIViewController) from the Object Library into the Interface Builder editor.  A new scene is created and your document should resemble this:
  4. Now, control-drag from the navigation controller to the new view controller.  When finished dragging, release your mouse button.
  5. You will be prompted for the type of connection to make.  Choose “Relationship – Root View Controller” as demonstrated:
  6. You’ve now coupled the navigation controller with a new view controller.  Aside from not reading “Root View Controller” at the top, this is identical to how the template was previously constructed. (Feel free to double-click the bar at the top of the new view controller and add text with the root view controller label if you wish.)

 

Posted in iOS 5 Errata, Notes

UIViewController and Other Classes No Longer Available Directly

In the most recent versions of Xcode (and future versions), classes such as UIViewController are not available as separate selections when adding a new class to your project. Instead, choose to create a new Objective-C class, then, on the second screen of the assistant, set the subclass to UIViewController (or whatever you need). From that point forward, everything should match up.

Frequently I question Apple’s changes to the UI, but, in this case, the change makes Xcode a bit more consistent.

Thanks to the readers for catching this!

Posted in iOS 5 Errata, Notes

Hour 14 FlowerColorTable Error

In the process of trying to consolidate examples for this latest edition, I introduced a bug into the Hour 14 “FlowerColorTable” project. To display the flower images in this tutorial, I used the name of the flower as the name of the image file – but I changed the capitalization.

This is a big no-no!

Unlike OS X, the iOS filesystem is case sensitive.  OS X is case-aware, but, by default, not case sensitive. As a result, the example ran fine in the iOS simulator (running off the OS X filesystem) but failed to show the flower images when run on a device.

The fix? Make the flower names given in the viewDidLoad method of the view controller match the file names, or vice versa.

Thanks to the readers for catching this!

Posted in iOS 5 Errata