# iOS Apprentice

**URL:** https://forums.kodeco.com/c/books/ios-apprentice/7.md?page=8

[Latest](https://forums.kodeco.com/latest.md) · [Categories](https://forums.kodeco.com/categories.md) · [Tags](https://forums.kodeco.com/tags.md)

**Page:** 9

---

## [MyLocation App Ch 29 Maps: Crash on actual iPhone XS](https://forums.kodeco.com/t/mylocation-app-ch-29-maps-crash-on-actual-iphone-xs/63315)

<div class="topic-metadata">

**Author:** [@adamsmorgantom](https://forums.kodeco.com/u/adamsmorgantom)\
**Replies:** 12\
**Last updated:** [March 28, 2019, 12:44am UTC](https://forums.kodeco.com/t/mylocation-app-ch-29-maps-crash-on-actual-iphone-xs/63315 "2019-03-28T00:44:53Z")

</div>

A fun real world problem I am trying to debug. iPhone XS crashes when the Map on the MyLocations App is accesed. This may be an Apple MapKit problem with a specific device. There is no issue when run on an iPhone 6S fo…

---

## [Update for Swift 5 and Xcode 10.2](https://forums.kodeco.com/t/update-for-swift-5-and-xcode-10-2/65659)

<div class="topic-metadata">

**Author:** [@mthon](https://forums.kodeco.com/u/mthon)\
**Replies:** 1\
**Last updated:** [March 27, 2019, 6:10am UTC](https://forums.kodeco.com/t/update-for-swift-5-and-xcode-10-2/65659 "2019-03-27T06:10:25Z")

</div>

will iOS Apprentice be updated to Swift 5 and Xcode 10.2? If so, when will it be published? Thanks!

---

## [Chapter 19: UI Improvements Section: Add Icons Error (‘image’ is unavailable: APIs as of iOS 7 and earlier are unavailable in Swift](https://forums.kodeco.com/t/chapter-19-ui-improvements-section-add-icons-error-image-is-unavailable-apis-as-of-ios-7-and-earlier-are-unavailable-in-swift/58230)

<div class="topic-metadata">

**Author:** [@ndx\_54](https://forums.kodeco.com/u/ndx_54)\
**Replies:** 5\
**Last updated:** [March 11, 2019, 3:58pm UTC](https://forums.kodeco.com/t/chapter-19-ui-improvements-section-add-icons-error-image-is-unavailable-apis-as-of-ios-7-and-earlier-are-unavailable-in-swift/58230 "2019-03-11T15:58:11Z")

</div>

Hello guys, I am currently stuck in the adding icons section of chapter 19. I added the following code: override func viewDidLoad() { super.viewDidLoad() if let checklist = checklistToEdit { title = “Ed…

---

## [Checklist !unwrapped optionals explanation - pg 428](https://forums.kodeco.com/t/checklist-unwrapped-optionals-explanation-pg-428/64173)

<div class="topic-metadata">

**Author:** [@chuck\_taylor](https://forums.kodeco.com/u/chuck_taylor)\
**Replies:** 2\
**Last updated:** [March 11, 2019, 2:18pm UTC](https://forums.kodeco.com/t/checklist-unwrapped-optionals-explanation-pg-428/64173 "2019-03-11T14:18:15Z")

</div>

Hi there, the two lines of code I’m curious about on pg 428 are: cell.textLabel!.text = someString cell.detailTextLabel!.text = anotherString I understand the reason we force unwrap textLabel and detailTextLabel, howev…

---

## [MyLocations - is check for .camera different on iPad6](https://forums.kodeco.com/t/mylocations-is-check-for-camera-different-on-ipad6/62961)

<div class="topic-metadata">

**Author:** [@zoran](https://forums.kodeco.com/u/zoran)\
**Replies:** 5\
**Last updated:** [March 5, 2019, 8:31am UTC](https://forums.kodeco.com/t/mylocations-is-check-for-camera-different-on-ipad6/62961 "2019-03-05T08:31:07Z")

</div>

MyLocations only crashes on physical iPad6 when you try and capture an image, however a physical iPhone8 and all the simulators work fine and provide the selection/choice to use camera or use image from library. I think …

---

## [KVO in the Checklists project](https://forums.kodeco.com/t/kvo-in-the-checklists-project/62712)

<div class="topic-metadata">

**Author:** [@feanor](https://forums.kodeco.com/u/feanor)\
**Replies:** 4\
**Last updated:** [March 4, 2019, 1:45pm UTC](https://forums.kodeco.com/t/kvo-in-the-checklists-project/62712 "2019-03-04T13:45:31Z")

</div>

if the Model wants to communicate with the controller, is KVO the only way? And have we used this in the Checklist project?

---

## [My Location app: Chapter 22 page: 524 Pop Up alert won't display](https://forums.kodeco.com/t/my-location-app-chapter-22-page-524-pop-up-alert-wont-display/62974)

<div class="topic-metadata">

**Author:** [@titkonen](https://forums.kodeco.com/u/titkonen)\
**Replies:** 2\
**Last updated:** [March 4, 2019, 7:15am UTC](https://forums.kodeco.com/t/my-location-app-chapter-22-page-524-pop-up-alert-wont-display/62974 "2019-03-04T07:15:48Z")

</div>

Hi, I have follow this tutorial step by step (two times), but I get stuck to that point (iOS Apprentice book page 524) where I should run the app and see alert: \*\*\> Run the app again and press the Get My Location butto…

---

## [Difference between selector and closure](https://forums.kodeco.com/t/difference-between-selector-and-closure/63092)

<div class="topic-metadata">

**Author:** [@jiang](https://forums.kodeco.com/u/jiang)\
**Replies:** 1\
**Last updated:** [March 3, 2019, 5:36am UTC](https://forums.kodeco.com/t/difference-between-selector-and-closure/63092 "2019-03-03T05:36:59Z")

</div>

Hi, I found these two approaches are quite similar in terms of functionality, can you explain the difference between these two? In my opinion, they are all approach to call a method to respond users action. Thanks

---

## [Tablecell height](https://forums.kodeco.com/t/tablecell-height/63185)

<div class="topic-metadata">

**Author:** [@jiang](https://forums.kodeco.com/u/jiang)\
**Replies:** 1\
**Last updated:** [March 3, 2019, 6:04am UTC](https://forums.kodeco.com/t/tablecell-height/63185 "2019-03-03T06:04:15Z")

</div>

Hello everyone, I have a question. In the MyLocation app, we put a imageView in a tablecell and making a imageHeight for dynamically adjust the height of the imageView, but I didn’t see any alternations made on the tabl…

---

## [Confusion about class](https://forums.kodeco.com/t/confusion-about-class/62553)

<div class="topic-metadata">

**Author:** [@feanor](https://forums.kodeco.com/u/feanor)\
**Replies:** 2\
**Last updated:** [February 24, 2019, 3:26am UTC](https://forums.kodeco.com/t/confusion-about-class/62553 "2019-02-24T03:26:11Z")

</div>

In the checklists project, why do we need to declare a new class in a new file? For example the ChecklistItem class in the ChecklistItem.swift file. Can’t we declare it in the viewController?

---

## [Chapter 13 Confusion about the source code](https://forums.kodeco.com/t/chapter-13-confusion-about-the-source-code/62281)

<div class="topic-metadata">

**Author:** [@feanor](https://forums.kodeco.com/u/feanor)\
**Replies:** 6\
**Last updated:** [February 18, 2019, 1:05am UTC](https://forums.kodeco.com/t/chapter-13-confusion-about-the-source-code/62281 "2019-02-18T01:05:32Z")

</div>

HI, I am new in swift. I first notice that on page 301 there is a screenshot showing a few lines of code, however, the code is different from the previous chapters and has no explanation. In Chapter 13 Source Code files,…

---

## [\[Checklists\] - Ch.20 \> crash](https://forums.kodeco.com/t/checklists-ch-20-crash/48722)

<div class="topic-metadata">

**Author:** [@notationmaster](https://forums.kodeco.com/u/notationmaster)\
**Replies:** 3\
**Last updated:** [February 17, 2019, 8:40pm UTC](https://forums.kodeco.com/t/checklists-ch-20-crash/48722 "2019-02-17T20:40:43Z")

</div>

Dear all, the app crashes as soon as I click the DatePicker row. I checked the code thrice and everything seems there. The error is quite clear in the Console: Terminating app due to uncaught exception ‘NSInternalInc…

---

## [Incorporate Checklists into another project](https://forums.kodeco.com/t/incorporate-checklists-into-another-project/61938)

<div class="topic-metadata">

**Author:** [@zivaev](https://forums.kodeco.com/u/zivaev)\
**Replies:** 2\
**Last updated:** [February 17, 2019, 8:39pm UTC](https://forums.kodeco.com/t/incorporate-checklists-into-another-project/61938 "2019-02-17T20:39:36Z")

</div>

Hello! How do I successfully import my Checklists app into a different one? For example, when I tap on ‘Planner’ button on my initial view controller I go to the Checklists app and everything works as usual? I have a SIG…

---

## [Chapter 16 Lists Data model](https://forums.kodeco.com/t/chapter-16-lists-data-model/62404)

<div class="topic-metadata">

**Author:** [@feanor](https://forums.kodeco.com/u/feanor)\
**Replies:** 2\
**Last updated:** [February 17, 2019, 1:05pm UTC](https://forums.kodeco.com/t/chapter-16-lists-data-model/62404 "2019-02-17T13:05:55Z")

</div>

Why do we need to create the data model file using Cocoa Touch class? Why can’t we use the Swift file and make it a subclass of NSPbject?

---

## [Bug in Lists chapter 16](https://forums.kodeco.com/t/bug-in-lists-chapter-16/62405)

<div class="topic-metadata">

**Author:** [@isaacballas2](https://forums.kodeco.com/u/isaacballas2)\
**Replies:** 1\
**Last updated:** [February 17, 2019, 4:45am UTC](https://forums.kodeco.com/t/bug-in-lists-chapter-16/62405 "2019-02-17T04:45:05Z")

</div>

On chapters 16 page 368 there is a bug in the code. Where it says to change tableview cell for row at, it tells us to write let cell = makeCell(for: tableView) however it results in a compiler error. Was this a mistake? …

---

## [Number of the item before the image](https://forums.kodeco.com/t/number-of-the-item-before-the-image/62224)

<div class="topic-metadata">

**Author:** [@marcogt](https://forums.kodeco.com/u/marcogt)\
**Replies:** 2\
**Last updated:** [February 14, 2019, 2:04pm UTC](https://forums.kodeco.com/t/number-of-the-item-before-the-image/62224 "2019-02-14T14:04:10Z")

</div>

Hi all, I have a very strange problem, before the name of the item I have the ID of the item, and to be honest I do not understand where it comes from If in the class ItemDetailViewController.swift I cannot see where t…

---

## [iconImage is null](https://forums.kodeco.com/t/iconimage-is-null/61714)

<div class="topic-metadata">

**Author:** [@marcogt](https://forums.kodeco.com/u/marcogt)\
**Replies:** 2\
**Last updated:** [February 14, 2019, 12:24pm UTC](https://forums.kodeco.com/t/iconimage-is-null/61714 "2019-02-14T12:24:36Z")

</div>

Hi all, I have almost completed Ch19 and I am stuck. At runtime I get basically a NullPointerException (I come from Java) iconImage.image = UIImage(named: iconName) is throwing a “null” exception. I checked “iconNam…

---

## [StoreSearch Chapter 38: Fatal Error](https://forums.kodeco.com/t/storesearch-chapter-38-fatal-error/45723)

<div class="topic-metadata">

**Author:** [@4423je](https://forums.kodeco.com/u/4423je)\
**Replies:** 1\
**Last updated:** [September 1, 2018, 2:13am UTC](https://forums.kodeco.com/t/storesearch-chapter-38-fatal-error/45723 "2018-09-01T02:13:41Z")

</div>

If the urlString is wrong and the TLD does not exist, response becomes nil and the seach ends up with a fatal error

---

## [Using views on iPads](https://forums.kodeco.com/t/using-views-on-ipads/61674)

<div class="topic-metadata">

**Author:** [@elearner](https://forums.kodeco.com/u/elearner)\
**Replies:** 2\
**Last updated:** [February 9, 2019, 8:41pm UTC](https://forums.kodeco.com/t/using-views-on-ipads/61674 "2019-02-09T20:41:58Z")

</div>

I just finished the tutorial on the “Bulls Eye” app. It uses a view to embed all the buttons and labels so that they’ll be properly displayed on all the different iPhones by adding constraints to the view only. I woul…

---

## [MyLocation Draw text on the UIView (HUD)](https://forums.kodeco.com/t/mylocation-draw-text-on-the-uiview-hud/61770)

<div class="topic-metadata">

**Author:** [@jiang](https://forums.kodeco.com/u/jiang)\
**Replies:** 1\
**Last updated:** [February 9, 2019, 7:57am UTC](https://forums.kodeco.com/t/mylocation-draw-text-on-the-uiview-hud/61770 "2019-02-09T07:57:27Z")

</div>

Hi, I followed example code to draw the text on the view using: text.draw(…), however, I noticed that there isn’t auto-complement for text. I couldn’t find the draw function from the menu, could you explain this?

---

## [Chapter 19 section Updating the unchecked item count on changes](https://forums.kodeco.com/t/chapter-19-section-updating-the-unchecked-item-count-on-changes/60773)

<div class="topic-metadata">

**Author:** [@mantonelli](https://forums.kodeco.com/u/mantonelli)\
**Replies:** 5\
**Last updated:** [February 8, 2019, 6:43pm UTC](https://forums.kodeco.com/t/chapter-19-section-updating-the-unchecked-item-count-on-changes/60773 "2019-02-08T18:43:00Z")

</div>

Hello I completed the section above but when I tap to return to the Checklists view it segues back to the item list. When I comment out the tableView.reloadData() it works. but obviously doesn’t update the sub title. …

---

## [Critical problems with creating groups in Xcode](https://forums.kodeco.com/t/critical-problems-with-creating-groups-in-xcode/61548)

<div class="topic-metadata">

**Author:** [@coder\_rgv7](https://forums.kodeco.com/u/coder_rgv7)\
**Replies:** 3\
**Last updated:** [February 7, 2019, 3:15pm UTC](https://forums.kodeco.com/t/critical-problems-with-creating-groups-in-xcode/61548 "2019-02-07T15:15:24Z")

</div>

I’m halfway through Chapter 27 of iOS Apprentice, and everything was proceeding smoothly until I decided to clean up the project navigator by grouping the files. I put all my view controllers into one group, all my core…

---

## [Chapter 20, setting height for datepickercell](https://forums.kodeco.com/t/chapter-20-setting-height-for-datepickercell/60213)

<div class="topic-metadata">

**Author:** [@jiang](https://forums.kodeco.com/u/jiang)\
**Replies:** 2\
**Last updated:** [February 6, 2019, 1:05pm UTC](https://forums.kodeco.com/t/chapter-20-setting-height-for-datepickercell/60213 "2019-02-06T13:05:18Z")

</div>

Hello, I’m confused about setting height for the datePickerCell. You manually set the datePickerCell height to 217 in the storyboard, however, you also call the tableView(:heightForRowAt) to set the row height to 217. W…

---

## [Chapter 25: Difference between unwind segue and delegate protocol](https://forums.kodeco.com/t/chapter-25-difference-between-unwind-segue-and-delegate-protocol/59917)

<div class="topic-metadata">

**Author:** [@internetstream](https://forums.kodeco.com/u/internetstream)\
**Replies:** 2\
**Last updated:** [February 6, 2019, 8:12am UTC](https://forums.kodeco.com/t/chapter-25-difference-between-unwind-segue-and-delegate-protocol/59917 "2019-02-06T08:12:52Z")

</div>

Hello @fahim, it is great that you describe different approaches for the similar thing in iOS Apprentice book. I have Googled it but still not sure when use unwind segue and when have to delegate protocol. It seems to me…

---

## [Constraints to margin](https://forums.kodeco.com/t/constraints-to-margin/61518)

<div class="topic-metadata">

**Author:** [@jiang](https://forums.kodeco.com/u/jiang)\
**Replies:** 1\
**Last updated:** [February 6, 2019, 8:03am UTC](https://forums.kodeco.com/t/constraints-to-margin/61518 "2019-02-06T08:03:35Z")

</div>

Hi, I have a question about the Constraint to Margins option when setting up the constraints. As my screenshot indicates, I set the tail constraint of the Detail label to be 16 (constraint to margins option checked). I…

---

## [Chapter 38: Polish the Pop-up :: Page 941 Exercises. My Solution Attempts](https://forums.kodeco.com/t/chapter-38-polish-the-pop-up-page-941-exercises-my-solution-attempts/44822)

<div class="topic-metadata">

**Author:** [@h1i2j3](https://forums.kodeco.com/u/h1i2j3)\
**Replies:** 0\
**Last updated:** [July 18, 2018, 9:54pm UTC](https://forums.kodeco.com/t/chapter-38-polish-the-pop-up-page-941-exercises-my-solution-attempts/44822 "2018-07-18T21:54:32Z")

</div>

iOS Apprentice, 6th edition Page 941 Exercises. My Solution Attempts Chapter 38: Polish the Pop-up :: Test Dynamic Type :: Page 941 Exercise. Set up the cells from the table view for Dynamic Type. SearchResultCell.x…

---

## [Chapter 29, page 699, in MapViewController.swift file, func region(for annotations: )](https://forums.kodeco.com/t/chapter-29-page-699-in-mapviewcontroller-swift-file-func-region-for-annotations/60171)

<div class="topic-metadata">

**Author:** [@tskho](https://forums.kodeco.com/u/tskho)\
**Replies:** 1\
**Last updated:** [February 6, 2019, 2:28am UTC](https://forums.kodeco.com/t/chapter-29-page-699-in-mapviewcontroller-swift-file-func-region-for-annotations/60171 "2019-02-06T02:28:12Z")

</div>

This part of code a little discouraged me let center = CLLocationCoordinate2D( latitude: topLeft.latitude - (topLeft.latitude - bottomRight.latitude) / 2, longitude: topLeft.longitude - …

---

## [Ch. 16 - Add new checklist - Cancel/Done button do not work](https://forums.kodeco.com/t/ch-16-add-new-checklist-cancel-done-button-do-not-work/61304)

<div class="topic-metadata">

**Author:** [@marcogt](https://forums.kodeco.com/u/marcogt)\
**Replies:** 2\
**Last updated:** [February 4, 2019, 8:36am UTC](https://forums.kodeco.com/t/ch-16-add-new-checklist-cancel-done-button-do-not-work/61304 "2019-02-04T08:36:08Z")

</div>

Hi all, I am having a problem with cancel/done buttons in the Add Checklist scene, in the ListDetailViewController.swift source file. @IBAction func cancel() { print("before") delegate?.listDetailViewController…

---

## [Data doesn't save when I click stop button on Xcode](https://forums.kodeco.com/t/data-doesnt-save-when-i-click-stop-button-on-xcode/59569)

<div class="topic-metadata">

**Author:** [@nimak](https://forums.kodeco.com/u/nimak)\
**Replies:** 1\
**Last updated:** [January 30, 2019, 7:53pm UTC](https://forums.kodeco.com/t/data-doesnt-save-when-i-click-stop-button-on-xcode/59569 "2019-01-30T19:53:02Z")

</div>

Hi, In the Checklist app, chapter 17, page 400, I invoked saveData() in applicationWillTerminate but still when I add some new data to the app and press stop, it doesn’t save any data. Like what book says “Press Stop i…

---

## [Chapter 15 iOS apprentice v 7 reading data](https://forums.kodeco.com/t/chapter-15-ios-apprentice-v-7-reading-data/60591)

<div class="topic-metadata">

**Author:** [@mantonelli](https://forums.kodeco.com/u/mantonelli)\
**Replies:** 4\
**Last updated:** [January 26, 2019, 1:12pm UTC](https://forums.kodeco.com/t/chapter-15-ios-apprentice-v-7-reading-data/60591 "2019-01-26T13:12:55Z")

</div>

I have successfully written and read the .plist file but when I open a file the text of the list items that were checked are right justified. this only happens when reading from a file. any idea what is wring?

[Previous page](https://forums.kodeco.com/c/books/ios-apprentice/7.md?page=7)

[Next page](https://forums.kodeco.com/c/books/ios-apprentice/7.md?page=9)
