NSManagedObjectModel无法从路径中读取MetaModel.mom

时间:2017-06-30 15:21:36

标签: ios objective-c core-data 32bit-64bit nsmanagedobjectmodel

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位架构运行良好。找出原因的任何帮助都是有价值的。谢谢。

0 个答案:

没有答案