webmagnets
webmagnets

Reputation: 2306

How can I update the version to fix this error?: 'Realm version is higher than the current version provided to `setSchemaVersion:withMigrationBlock:`'

I am getting the following error:

Terminating app due to uncaught exception 'RLMException', reason: 'Realm version is higher than the current version provided to `setSchemaVersion:withMigrationBlock:`'

How do I update the version provided to setSchemaVersion:withMigrationBlock?

Upvotes: 0

Views: 415

Answers (1)

Ari
Ari

Reputation: 1447

You need to call:

[RLMRealm setSchemaVersion:newVersion withMigrationBlock:^{
    // add migration code here
}];

before accessing any Realms.

If you have only made changes to your schema locally (ie you haven't yet shipped your app) you can instead simply delete your Realm files or the entire app from the simulator/device to reset everything.

The error message when hitting this error has been changed here:

https://github.com/realm/realm-cocoa/pull/1167

Upvotes: 1

Related Questions