IPhone core data example gives an exception

No longer under the NDA.

An example was detected in the iPhone Core Data example, but now it is fixed. Also the sample code was always correct, they just left some details in the tutorial.

(see iPhone Dev Forums for an explanation)

I created the application twice and got the same error twice (but in two different places):

Application termination due to a non-displayable exception 'NSInternalInconsistencyException', reason: '+ entityForName: could not find NSManagedObjectModel for event object name

I read apple docs :

This indicates a problem with the missing model, or the context is zero, or the storage store is invalid.

However, since this is my first Core Data project, I am a little weak in debugging. If necessary, I can send the code.

Any help is greatly appreciated.

+4
source share
1 answer

I have found the answer. (If you want the SDK version of the iPhone 3.0 sdk, refer to the link at the bottom of the page) This is what should be in the application delegation applicationDidFinishLaunching application, it should be like this:

(void)applicationDidFinishLaunching:(UIApplication *)application { NSManagedObjectContext *context = [self managedObjectContext]; if (!context) { // Handle the error. } RootViewController *rootViewController = [[RootViewController alloc] initWithStyle:UITableViewStylePlain]; rootViewController.managedObjectContext = context; UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController]; self.navigationController = aNavigationController; [window addSubview:[navigationController view]]; [window makeKeyAndVisible]; [rootViewController release]; [aNavigationController release]; } 

iPhone Dev Forums Link

+8
source

All Articles