What do in need to do to rename the .xcdatamodel file. Renaming .xcdatamodel filename, along with changing ...
NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"newfilename" withExtension:@"momd"];
__managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
return __managedObjectModel;
and
NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"newfilename.sqlite"];
doesn't work! I get following error:
2011-04-11 17:19:54.164 ProjectName[5826:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Cannot create an NSPersistentStoreCoordinator with a nil model'
*** Call stack at first throw:
(
0 CoreFoundation 0x00fa15a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x010f5313 objc_exception_throw + 44
2 CoreData 0x00013853 -[NSPersistentStoreCoordinator initWithManagedObjectModel:] + 419
3 ProjectName 0x00003471 -[ProjectNameAppDelegate persistentStoreCoordinator] + 257
4 ProjectName 0x000031a4 -[ProjectNameAppDelegate managedObjectContext] + 100
5 ProjectName 0x000028ca -[ProjectNameAppDelegate makeSplitViewController] + 762
6 ProjectName 0x00002d44 -[ProjectNameAppDelegate application:didFinishLaunchingWithOptions:] + 68
7 UIKit 0x001f3c89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
8 UIKit 0x001f5d88 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
9 UIKit 0x00200617 -[UIApplication handleEvent:withNewEvent:] + 1533
10 UIKit 0x001f8abf -[UIApplication sendEvent:] + 71
11 UIKit 0x001fdf2e _UIApplicationHandleEvent + 7576
12 GraphicsServices 0x018f9992 PurpleEventCallback + 1550
13 CoreFoundation 0x00f82944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
14 CoreFoundation 0x00ee2cf7 __CFRunLoopDoSource1 + 215
15 CoreFoundation 0x00edff83 __CFRunLoopRun + 979
16 CoreFoundation 0x00edf840 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x00edf761 CFRunLoopRunInMode + 97
18 UIKit 0x001f57d2 -[UIApplication _run] + 623
19 UIKit 0x00201c93 UIApplicationMain + 1160
20 ProjectName 0x00002599 main + 121
21 ProjectName 0x00002515 start + 53
)
terminate called after throwing an instance of 'NSException'
Note: I'm using Xcode4.