Tags Page -- Error When Running Solution Code

First off – thanks for the great book. I’m learning so much.

When I download, build and run the Chapter 23 solution code, I get the following error when I navigate to the “Tags” view. The App crashes on this line:

class AppDelegate: UIResponder, UIApplicationDelegate {

and then I get the following error in the console:

2017-02-28 16:04:07.543 Photorama[872:11364] *** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘NSFetchRequest could not locate an NSEntityDescription for entity name ‘Tag’’

I’m running an iPhone 7 simulator. Building with XCode 8.2. I was able to build and run the solution code for 20, 21 and 22.

Thanks for the help – Mike

Hi Mike,

It sounds as if Core Data doesn’t know of the ‘Tags’ entity. (weird because you’ve downloaded the solution)

Please supply two things:

  1. A small screenshot of the view in Xcode of the .xcdatamodel selected, with particular attention to the left column (containing Entities, Fetch Requests and Configurations)

  2. The code of your fetchAllTags(completion:) function.

Format the code: If the pasted code isn’t left-indented by 4 spaces, you can select it and click on the </> button above your reply. Nicely formatted code will appear in the right block as you’re creating a reply.


Old post, but for anyone else experiencing trouble getting the Tag class to work… I experienced a similar issue while working my way through Ch. 23. After I added the Tag entity and references to it throughout the code, Xcode acted as if the Tag class didn’t exist (lots of errors).

Product > Clean didn’t work, but simply quitting/restarting Xcode did the trick.