[英]How to resolve with a exception “Cannot start to manage an object with a realm when it's already managed by another realm”
[英]Realm , Object is already managed by another Realm
RLMModels
我更改了配置使用
RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration]; config.fileURL = [[[config.fileURL URLByDeletingLastPathComponent] URLByAppendingPathComponent:@"myname"] URLByAppendingPathExtension:@"realm"]; [RLMRealmConfiguration setDefaultConfiguration:config];
我addOrUpdate
相同的RLMModels
控制台打印錯誤:
2017-11-09 10:50:18.293801+0800 LNLibBase_Example[96588:8779968] *** Terminating app due to uncaught exception 'RLMException', reason: 'Object is already managed by another Realm. Use create instead to copy it into this Realm.'
正如錯誤消息所述,已經由Realm管理的對象無法添加到其他Realm。 你可以做的是使用+createInRealm:withValue:
在不同的Realm中創建它的副本 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.