NSManagedObjectModel initWithContentsOfURL returns nil eventhough the modelURL is valid

后端 未结 6 500
伪装坚强ぢ
伪装坚强ぢ 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:08

    When I ran the project the first time, I specified the extension as xcdatamodeld. But that failed since, it should be momd. But I passed a nil instead of momd assuming extension won't be mandatory. But with nil, the initWithContentsOfURL failed and when I finally entered momd,it worked fine.

提交回复
热议问题