Errata in iOS Programming, 6th Ed


Find an error or typo? Note it here!


Hi there! In Chapter 9, Debugging, at the start of the LLDB section (loc 3783 on Kindle), the code calls array.remove(at:) which takes an object. So this line doesn’t remove any items from the array, and the program doesn’t crash as expected.

I changed it to array.removeObject(at:) which then worked.



Hi, I’m reading the book on Safari Books and so I do not have a page number, but near figure 1.11 it says:

Using the guidelines, position the label in the horizontal center of the view and near the top, as shown in Figure 1.11. Eventually, this label will display questions to the user. Drag a second label onto the view and position it in the horizontal center, closer to the middle. This label will display answers.

I believe that it should say:

Using the guidelines, position the label in the horizontal center of the view and near the top, as shown in Figure 1.11. Eventually, this label will display questions to the user. Drag a second label onto the view and position it in the vertical center, closer to the middle. This label will display answers.

The second label is meant to be near the vertical center as shown in figure 1.12


In chapter 10, just after figure 10.14, a call to UITableViewCell is changed to tableView.dequeueReusableCell. This creates compile-time errors because the returned cell is now an optional and must be unwrapped in the subsequent instructions, like so:

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier: "UITableViewCell")
    let item = itemStore.allItems[indexPath.row]
    cell?.textLabel?.text =
    cell?.detailTextLabel?.text = "$\(item.valueInDollars)"
    return cell!


Chapter 7: Localization, page 137

It’s the old switcheroo…

When the segmented control was added to the WorldTrotter Map (page 108) it was done in the order Standard, Hybrid, Satellite.

But when it’s localized on page 137, both the struck-out code and the new code use the order Standard, Satellite, Hybrid.

Not surprisingly, this new order cascades upon itself. In addition to being carried over to the screenshot of the running app on page 139, the order of the strings in Localizable.strings (as shown on page 138) is based on the order in the source file.

(Correcting this by changing just the struck-out code is not sufficient, of course, since other code checks which absolute segment was touched.)


Chapter 8: Controlling Animations, page 146

We override viewWillAppear(_:slight_smile: to set questionLabel.alpha = 0…but the only time we call animateLabelTransitions() is when showNextQuestion(_:slight_smile: is invoked.

When the app is first launched, viewWIllAppear(_:slight_smile: is invoked but not showNextQuestion(_:slight_smile: so questionLabel.alpha is left at 0 and the first question does not display.

Thus, it seems we should also call animateLabelTransitions() at the end of viewWillAppear(_:).

(Side note: if we DO add animateLabelTransitions() to the end of viewWillAppear(_:), then on page 147, when we tweak viewDidLoad() to set currentQuestionLabel.text, we should instead tweak nextQuestionLabel.text instead, since animateLabelTransitions() will transition the currentQuestionLabel alpha to 0 and the nextQuestionAlpha to 1.)


The download solution provided for Chapter 24 is still using Swift 2, not Swift 3. It need to be updated to Swift 3


Not sure if this is just an Xcode version issue, I’m using 8.2.1… but in chapter 4, p. 73 (of version purchased through pearson I think it was), the instructions follow:

The interface doesn’t seem to have the indicated instruction “Resolve Auto Layout Issues menu, and select Update Frames from the All Views in View Controller section.”

Instead I used the update button while the background view was selected and I THINK that does the same thing.


This is not correct. The reason you are having problems is you are not using all the parameters in the method. You are missing for: indexPath. It should look like this.

let cell = tableView.dequeueReusableCell(withIdentifier: “UITableViewCell”, for: indexPath)

You also have to set the Identifier in the cell prototype attributes inspector to UITableViewCell


A few minor things:
pg 35, let fmStation = 91.1 gives actual Swift results of 91.09999999999999
pg 35, Swift results are ordered differently for let nameByParkingSpace = [13: “Alice”, 27: “Bob”] – [27: “Bob”, 13: “Alice”]
pg 36, Swift results again ordered differently, let availableRooms = Set([205, 411, 412]) – {411, 205, 412} – I frankly don’t understand this one


Just a note. For Adding more constraints on page 67-68, following the given instructions does not work if some of the labels overlap, as it won’t identify the nearest neighbor correctly. You could end up with labels piled on each other.


Chapter 14, UINavigationController

On page 250, the code for dismissing the keyboard using a UITapGestureRecognizer is incorrect.

It should be



Chapter 7, page 137

When I go to the terminal and enter “genstrings MapViewController.swift” and return, nothing happens. No file named Localizable.strings appears.


I solved it. I did not close xcode. It has to be closed for the file to appear in finder.


Chapter 15 in the “Solutions” folder. If you test this, there will be an error in the ImageStore file:

let cache = NSCache<String, UIImage>()

Change this line to:

let cache = NSCache<NSString, UIImage>()


The following source code (citation auto generated by kindle below) doesn’t take into account the semantics of shouldChangeCharactersIn when the user is pasting text. If the pasted text changes some of the digits and contains a decimal, but is replacing a decimal the paste won’t work. This is an edge case, but the real problem is that it clouds the semantics of shouldChangeCharactersIn for someone new to that function.

let existingTextHasDecimalSeparator = textField.text?. range( of: ".") let replacementTextHasDecimalSeparator = string.range( of: ".") if existingTextHasDecimalSeparator != nil, replacementTextHasDecimalSeparator != nil { return false } else { return true }

Keur,Christian; Hillegass,Aaron. iOS Programming: The Big Nerd Ranch Guide (Big Nerd Ranch Guides) (Kindle Locations 2211-2214). Big Nerd Ranch Guides. Kindle Edition.

If this errata is accepted I would appreciate knowing via direct message or email,


re: selectedIndexPaths array
@ Chap 23: Core Data Relationships: Adding Tags To The Interface, location 9238

Text mentions selectedIndexPaths here:
“In TagsViewController.swift, add the appropriate index paths to the selectedIndexPaths array.”

But, instruction to add this array was omitted, and doesn’t show in book code.
Did find it in downloaded source code.

Omitted line should be:

var selectedIndexPaths = [IndexPath]()


Minor grammar error.

Page 321
Chapter 18: Touch Events and UIResponder
Section: Drawing with DrawView
Para 1

An instance of DrawView needs to be able draw lines.

Should be

An instance of DrawView needs to be able to draw lines.


In Chapter 2, P.32, Figure 3.2 A Playground. Just a tip, I am always forced to add the line import PlaygroundSupport to a Playground while running xCode 8 on my macBook plus. Otherwise, the Playground just endlessly spins and the code never executes.


On page 183, in the Figure 10.6 Homepwner object Diagram, I believe there is a relationship arrow missing between ItemsViewController and ItemStore. The Controller has access to the store, as stated on the following page, 184 “Giving the controller access to the store” section. We added a property for an ItemStore to the ItemsViewController, thus establishing a relationship between the two. Update the diagram to show the connection between the controller and the model (ItemStore).