3
votes

I'm doing this tutorial and there they use pod 'RealmSwift', '~> 0.98'. But when I try to open the default.realmfile with the Realm Browser Version 2.0.0 (78). There is always the alert

'default.realm' is at an older file format version and must be upgraded before it can be opened. Would you like to proceed?

enter image description here

So I tried to use the latest version of RealmSwift. Even with using the latest version, the message appears.

When I proceed and upgrade the file, I can open it and see also the records. But the problem is, when I close the realm browser after this and start the app again, an error appears

fatal error: 'try!' expression unexpectedly raised an error: ... "Unable to open a realm at path ... Unsupported Realm file format version."

Note: As in the tutorial mentioned, they use try! instead of try and do/catch for simplifying

So how can I open the realm file with or without upgrading it and still have an working app after accessing the file again with app?

Searched for other solutions on SO, but didn't find one so far.

1
I'm not sure I understand what your goal is: do you want to be using the newest Realm version, and are having trouble migrating your existing local realm files? Also, when you say you used the latest version of RealmSwift, you updated your Cocoapod to the newest version? The screenshot you're showing indicates a local upgrade of 1 file, not a persistent solution for your app.BHendricks
The goal is just to open the realm file after adding some records via the app. Then to see the added records in the realm browser. After closing the realm browser to continue working with the app. But as I mentioned in my question, I can only open the file with the browser after proceeding with upgrade, but then the error occurs with Unable to open realm at.... I didn't checked the Cocoapod first, but it's 1.0.1 @BHendricksronatory

1 Answers

3
votes

It looks like your essentially getting a mismatch between your cocoapods version of Realm and the version RealmBrowser is expecting. I think you have 2 options:

1) Upgrade RealmSwift cocoapods to match what RealmBrowser is expecting 2) Downgrade RealmBrowser version to match what version of RealmSwift cocoapods you have

The issue you're seeing of fatal error: 'try!' expression unexpectedly raised an error: ... "Unable to open a realm at path ... Unsupported Realm file format version." is because the RealmBrowser application is upgrading your realm database file, and then when you go back to the application, it is now in a "too-upgraded" format, so to speak.