ios '+entityForName: nil is not a legal NSPersistentStoreCoordinator for searching for entity name '

我这引发这个问题是因为我创建完context后没有和store进行绑定,导致当前的context中的store是nil,然后由context中的store再去搜索实体当然就异常啦。

添加

    _context.persistentStoreCoordinator = store;

就ok了

猜你喜欢

转载自blog.csdn.net/weixin_40200876/article/details/87866492