如何删除Xcode中的旧数据模型?菜单上禁用该选项.(我想删除的模型尚未向公众发布 - 它们是临时开发模型.)
重命名.xcdatamodel文件需要做什么.重命名.xcdatamodel文件名,以及更改...
NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"newfilename" withExtension:@"momd"];
__managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
return __managedObjectModel;
Run Code Online (Sandbox Code Playgroud)
和
NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"newfilename.sqlite"];
Run Code Online (Sandbox Code Playgroud)
不起作用!我收到以下错误:
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 …Run Code Online (Sandbox Code Playgroud)