Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Diary app using core data - no entries showing in table view

I've obviously done something wrong with this app as I thought I'd followed all the necessary steps. However, I can't get the Root View Controller to show any entries that I have made.

What are the key things that need to be in place for this to work?

The class is linked to the table view controller in the storyboard, i.e. the Custom Class is set as EntryListViewController - is that right?

Apart from that, I can't see what's amiss. There's a [self.tableView reloadData] method.

Is the EntryListViewController file a subclass of UITableViewController?

Any tips would be welcome!

Thanks,

Steve.

Hey Steve,

I had the same problem. To answer your question yes EntryListViewController was created as a subclass of UITableViewController Fetch Request (around the 1min mark), and like you said, the class must also be linked to the table view controller in the storyboard, i.e. the Custom Class is set as EntryListViewController Fetched Results Controller (8min mark).

If that fails, download the project files as per Steve Smith suggested and compared them one by one. If after doing that, the problem still persists, like in my case, just use those same downloaded project files and use them to continue the app. I restarted the project twice and still couldn't find the bug.

2 Answers

I had omitted the line:

[self.fetchedResultsController performFetch:nil];

Now fixed!

That's great man. Now, you make me wonder if I should've triple checked.

You can download the project files at the end of each stage, and when you get stuck and can't figure out how to get unstuck it's useful to get the current project snapshot and compare the class files with your own to see what's missing or mistyped. It's harder to compare parameters set through the storyboard, but pretty easy to compare class files.