I have completed the MyLocations app all the way through the Photo Picker section, yet when I try to change the photo for my location, this change is not reflected.
Other related functions seem to work fine. I can add and delete photos and this is reflected in the documents directory and SQL database.
Here is my project on GitHub:
Help!
C’mon guys. Dying over here.
What do you mean exactly by “this change is not reflected”? What doesn’t happen and what did you expect to happen instead?
Hey Matthijs!
When I try to change the image for a location in the Location Details View Controller, the image will change on the Location Details View Controller immediately. However, when I back out to the Locations View Controller, the image has not updated. And when I go back into the Location Details View Controller, the image has reverted to the original image. Hopefully that’s enough information? Let me know, if not.
I put a link to my GitHub project in my first post. The app is otherwise completed except for this problem. Thank you, a great learning experience!
Savage
Sorry for the slow reply. In your LocationDetailsViewController, inside done(), the following happens:
if let image = image {
if !location.hasPhoto {
location.photoID = Location.nextPhotoID() as NSNumber
if let data = UIImageJPEGRepresentation(image, 0.5) {
do {
try data.write(to: location.photoURL, options: .atomic)
} catch {
print("Error while writing file: \(error)")
}
}
}
}
However, it should look like this:
if let image = image {
if !location.hasPhoto {
location.photoID = Location.nextPhotoID() as NSNumber
}
if let data = UIImageJPEGRepresentation(image, 0.5) {
do {
try data.write(to: location.photoURL, options: .atomic)
} catch {
print("Error writing file: \(error)")
}
}
}
Spot the differences. 
OF COURSE. Ugh.
I thought I was done with braces at 15, but now I can see they will haunt me forever.
Thanks Matthijs!