问题
I'm using realm
and react native
to write a mobile app. Everything was working fine and then I tried to open my default.realm file in the Realm Browser at which point it asked me to upgrade to a new version. I upgraded and was able to open the default.realm file in the browser, however when I opened my app in the simulator, I get the following error now:
Unable to open a realm path at [REALM PATH]. Unsupported Realm File Format Version
Any suggestions?
回答1:
Upgrade Your realm
package in Your App.
When you updated the .realm
file in Realm Studio, it became incompatible with older versions of Realm so the app on your simulator can no longer open up that .realm
file.
All you should have to do is update the version of realm
package in your application and that will move it inline with the updated version of that .realm
database.
I had to do the same thing and ended up upgrading from 1.3.0 to 2.23.0. A big update, but then everything worked great.
If you still run into trouble after updating, I would suggest removing node_modules
, cleaning the build and unlinking any existing Realm libraries so you're not accidentally using a cached or older version.
回答2:
Alright, I don't know if this is the right way to address this issue, but I just went in and deleted the default.realm file specified in the error message and it generate a new one and all is well with the world. Please let me know if there's a better solution. Cheers!
回答3:
Which version of Realm React Native are you using? You should upgrade it to the latest to support the newest file format.
来源:https://stackoverflow.com/questions/43297928/receiving-unsupported-realm-file-format-after-upgraing