I\'m playing around with realm (currently 0.85.0) and my application uses the database to store user-specific data such as the contacts of the current user. When the user de
I ran into this fun little issue. So instead i queried the schema version directly before running the schemamigration.
NSError *error = NULL;
NSUInteger currentSchemaVersion = [RLMRealm schemaVersionAtPath:[RLMRealm defaultRealmPath] error:&error];
if (currentSchemaVersion == RLMNotVersioned) {
// new db, skip
} else if (currentSchemaVersion < 26) {
// kill local db
[[NSFileManager defaultManager] removeItemAtPath:[RLMRealm defaultRealmPath] error:&error];
if (error) {
MRLogError(error);
}
} else if (error) {
// for good measure...
MRLogError(error);
}
// perform realm migration
[RLMRealm setSchemaVersion:26
forRealmAtPath:[RLMRealm defaultRealmPath]
withMigrationBlock:^(RLMMigration *migration, NSUInteger oldSchemaVersion) {
}];