I recently created a new branch and tried to reorganize most of my code to give Realm snapshot of CoreData . But so far I have been unlucky for my code to work.
First, an exception is thrown in shared_realm.cpp. The line of code that causes the error:
if (realm->config().schema_version != config.schema_version && config.schema_version != ObjectStore::NotVersioned) { throw MismatchedConfigException("Realm at path already opened with different schema version."); }
If I skip this exception, it will catch the second line of code in the following:
class func getAllCategories() -> Results<Category> { let realm = try! Realm() let categories = realm.objects(Category) return categories }
And it gives this error message:
fatal error: 'try!' the expression unexpectedly caused an error: Error Domain = io.realm Code = 1 "The kingdom is on a path already open with different version of the scheme." UserInfo = {NSLocalizedDescription = Realm on the path is already open with a different version of the schema., Error code = 1}
I am completely new to the kingdom, so any help is appreciated. My understanding from the documentation is that Realm() is the right way to access the default database, which I can currently use. At first I thought it might have been necessary to survive the kingdom, but from the online examples I see that this does not seem to be the case.
I cleaned, changed simulators, and even updated Xcode. I also tried to comment on this line of code:
// FIXME - enable schema comparison /*if (realm->config().schema != config.schema) { throw MismatchedConfigException("Realm at path already opened with different schema"); }*/
to no avail. Feeling completely lost, so any direction is appreciated.
source share