if (_metaContextModel == nil) {
if (s_metadataModelRoot == nil)
{
NSString *modelPath = [[NSBundle mainBundle] pathForResource: @"MetaModel" ofType: @"momd"];
BOOL isDirectory;
if ([[NSFileManager defaultManager] fileExistsAtPath: modelPath isDirectory: &isDirectory]) {
if (isDirectory)
_metaContextModel = [NSManagedObjectModel modelWithContentsOfFile: [modelPath stringByAppendingPathComponent: @"MetaModel.mom"]]; ///My code is crashing in this line.
else
_metaContextModel = [NSManagedObjectModel modelWithContentsOfFile: modelPath];
}
NSManagedObjectModel 无法从路径中读取 MetaModel.mom。MetaModel.mom 存在于路径中,但无法从路径中读取它。它也存在于我的项目文件夹中。如果我调试代码,它会从该行返回而不是继续,屏幕变黑并且没有崩溃。我正在为我的应用程序使用 64 位架构,而早期的 32 位架构运行良好。找出原因的任何帮助都是有价值的。谢谢你。