NSManagedObjectModel initWithContentsOfURL returns nil eventhough the modelURL is valid

后端 未结 6 481
伪装坚强ぢ
伪装坚强ぢ 2021-01-01 13:42

my NSManagedObjectModel is returning nil eventhough the path is correct.

        NSString *modelKey = [NSString stringWithFormat:@\"/%@/Model\", name];
    N         


        
6条回答
  •  轮回少年
    2021-01-01 14:25

    I tried both of the above answers, however what fixed it for me was removing and re-adding the .xcdatamodeld file from/to the Xcode project. No cleaning was necessary. For some reason adding it back seems to fix the problem.

提交回复
热议问题