How can I ensure Realm schema is identical across Android and iOS?

…衆ロ難τιáo~ 提交于 2020-01-04 05:23:09

问题


I'm looking at using Realm for a project where we have both iOS and Android clients.

It looks like there's not any way to ensure that the database schemas are the same on both platforms, such that the data stores could be exchanged between them. Since the schema is effectively defined in code, how can I ensure they remain compatible?


回答1:


The Realm browser can generate Models from existing Realm files in multiple languages. So maybe you could create a realm file on one platform and then use the browser to generate the counterpart for the other language?




回答2:


The realm documentation says that Realm files are cross platform.

https://realm.io/docs/swift/latest/#finding-a-realm-file

You can follow the instructions in that section to make sure your schemas are the same.



来源:https://stackoverflow.com/questions/33091489/how-can-i-ensure-realm-schema-is-identical-across-android-and-ios

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!