1

我创建了一个新的对象模型,当我打开我的应用程序时,我收到以下错误:

*** 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.Configuration.defaultConfiguration = Realm.Configuration(
        syncConfiguration: (user, syncServerURL!),
        objectTypes: [Dot.self, Mod.self, Setting.self])

这让我相信我需要为我的远程领域运行迁移。我怎样才能做到这一点?

4

1 回答 1

0

您无法从客户端直接访问服务器上的 Realm 文件。您需要做的就是在本地运行迁移,并将更改推送到服务器。

如果您不删除任何列,则可以像这样简单地运行迁移:

Realm.Configuration.defaultConfiguration = Realm.Configuration(
        syncConfiguration: (user, syncServerURL!),
        schemaVersion: 1,
        migrationBlock: { migration, oldSchemaVersion in },
        objectTypes: [Dot.self, Mod.self, Setting.self])

我希望这会有所帮助!

于 2016-10-25T18:27:30.600 回答