Practical Instruments - Part 8: Conclusion | Ray Wenderlich

In this conclusion you'll get a recap of what you've learned so far and a few pointers for further study.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4065-practical-instruments/lessons/8

FYI, viewers.
There is a crash in the sample projects provided for Part 7: Energy.
The runtime error is:

Could not cast value of type ‘__NSArrayM’ (0x10ff93a88) to ‘NSString’ (0x10f1050d0).
2018-03-06 21:12:01.500183-0600 Catstagram[65887:2051073] Could not cast value of type ‘__NSArrayM’ (0x10ff93a88) to ‘NSString’ (0x10f1050d0).

You can fix it by changing the code as provided below.

Class name: PhotoModel.swift
Method: init

Current code:

init(photoDictionary: [String: Any]) {
let urlString = photoDictionary[“image_url”] as! String


}

to be code:

init(photoDictionary: [String: Any]) {
    let result:NSArray = photoDictionary["image_url"] as! NSArray
    let urlString = result[0] as! String



}