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.'
答案 0 :(得分:1)
如错误消息所述,已经由Realm管理的对象无法添加到其他Realm。您可以做的是使用+createInRealm:withValue:
在不同的Realm中创建副本。