如何引用我在静态库项目中创建的模型?
这将返回 null 并抛出错误,因为资源位于此静态库中:
//this code is in the static library
- (NSManagedObjectModel *)managedObjectModel
{
if (__managedObjectModel != nil) {
return __managedObjectModel;
}
NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"eCommerceEngine" withExtension:@"mom"];
__managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
return __managedObjectModel;
}
如何将其更改为从此静态库中提取?