我创建了一个新的对象模型,当我打开我的应用程序时,出现以下错误:
*** Terminating app due to uncaught exception 'RLMException', reason: 'Invalid class subset list:
- 'Mod.generalSettings' links to class 'Setting', which is missing from the list of classes managed by the Realm
- 'Mod.contextSettings' links to class 'Setting', which is missing from the list of classes managed by the Realm
- 'Mod.accountSettings' links to class 'Setting', which is missing from the list of classes managed by the Realm'
当我关闭保存同步 Realm 的 Realm 对象服务器时,我没有收到此错误。这是启动时运行的配置:
Realm.Configuration.defaultConfiguration = Realm.Configuration(
syncConfiguration: (user, syncServerURL!),
objectTypes: [Dot.self, Mod.self, Setting.self])
这让我相信我需要为我的远程 Realm 运行迁移。我怎样才能做到这一点?
最佳答案
您无法从客户端直接访问服务器上的 Realm 文件。您所需要做的就是在本地运行迁移,更改将被推送到服务器。
如果您不删除任何列,则可以运行迁移,如下所示:
Realm.Configuration.defaultConfiguration = Realm.Configuration(
syncConfiguration: (user, syncServerURL!),
schemaVersion: 1,
migrationBlock: { migration, oldSchemaVersion in },
objectTypes: [Dot.self, Mod.self, Setting.self])
希望对您有所帮助!
关于ios - 在同步 Realm 上运行迁移,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40229356/