Download my source for reference!
I’m new to iOS development and I’m trying to learn on my own…I need some assistance
Firstly, I’m getting an error when switching to the “Safety Culture Master View”…

2012-06-07 11:50:54.720 SafetyCulture[1777:fb03] *** Terminating app
due to uncaught exception ‘NSInternalInconsistencyException’, reason:
‘+entityForName: could not locate an NSManagedObjectModel for entity
name ‘Event”
I don’t know how to resolve this…
Secondly, I want to create a record via a two-step process…and on the “question…” VC, I want the user to answer about 20 questions–but they’ll all be formatted the same way, so I don’t need additional xibs, do I? So when it gets to the last question, I want the “next” button to say “finish” or “save”…should be simple?
I’m eager to get on my feet with Xcode…if you need additional information, please let me know and I’ll do my best!
I tracked down the code which was throwing the exception:
in your method
- (NSFetchedResultsController *)fetchedResultsController, a custom setter for the property of the same name, which initializes one if not present. The real problem is thatself.managedObjectContextis currently nil. Nowhere in your code is the master view controller assigned the managedObjectContext.The easiest way to do this is to grab it from the AppDelegate, in this manner
This was pretty easy to solve using breakpoints, which I urge you to learn how to use as they are incredibly useful with reproducible bugs like these.
As for your second question, there are a million ways to skin this cat. There’s nothing wrong with creating a bunch of scenes and having push segues between them, and give them a shared “question class”. It would look pretty nice and there wouldn’t be much code involved. Performance won’t be an issue.
That said, if you want to do it programmatically, use an NSArray of NSDictionaries, with each dict holding a question and possible answers, and program the controller to load them from the array when hitting back or forward, remembering to save. If the questions are static, I really urge you to use the Storyboard approach, though. Far less fiddly.
Breakpoints and segues are all well and good, but right now I urge you to make a coffee, get some biscuits and read the Core Data Programming Guide cover to cover. You’ll find Apple’s documentation highly accessible.
If you’re really new to this, follow this advice. It worked for me.