Reputation: 4318
Why this exception is thrown (when I'm trying to migrate multiple realms)?
bool ObjectStore::is_schema_at_version(Group *group, uint64_t version) {
uint64_t old_version = get_schema_version(group);
if (old_version > version && old_version != NotVersioned) {
throw ObjectStoreException(ObjectStoreException::Kind::RealmVersionGreaterThanSchemaVersion,
{{"old_version", to_string(old_version)}, {"new_version", to_string(version)}});
}
return old_version != version;
}
Upvotes: 0
Views: 466
Reputation: 4318
First of all I needed to instantiate realmconfig in the right way.
RLMRealmConfiguration *someOtherConfig = [[RLMRealmConfiguration defaultConfiguration] copy];
Instead of:
RLMRealmConfiguration *someOtherConfig = [[RLMRealmConfiguration alloc] init];
And I needed to remove the additional schemaVersion config and redundant migrationblocks:
config.schemaVersion = migrationVersion;
Before performing the actual migration:
[RLMRealm migrateRealm:someOtherConfig];
Upvotes: 2