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.'
最佳答案
如错误消息所述,无法将已由领域管理的对象添加到其他领域。您可以做的是使用 +createInRealm:withValue:
在不同的领域中创建它的副本。