Core Data - Failed to load optimized model at path

后端 未结 5 1625
南方客
南方客 2020-11-27 15:21

I\'m getting some of these prints in my console while running my application from Xcode 6 in my iPhone 6 with iOS 9 beta 5:

CoreData: Failed to load o

5条回答
  •  执笔经年
    2020-11-27 16:14

    I ran into this problem this morning. Did a small hack to get it running. I think it's got something to do with versioning mismatch but I'm not sure.

    Anyhow, if you're loading a momd-file, just append a "/[filename].mom" to the NSURL to get it working.

    In my case, I was loading the file Countly.momd and ended up doing this:

    // Original loading
    NSURL modelURL = [[NSBundle bundleForClass:[CountlyDB class]] URLForResource:@"Countly" withExtension:@"momd"];
    
    // Small hack
    modelURL = [modelURL URLByAppendingPathComponent:@"Countly.mom"];
    

    Update: I was using a POD that used CoreData. Removing the pod and adding the source etc. from repo directly made the problem go away.

    So it might be a pod-issue.

提交回复
热议问题