I am getting memory leak during migration using Realm (v1.0.2). My code looks like that:
let config = Realm.Configuration(
schemaVersion: 1,
migrationBlock: { migration, oldSchemaVersion in
// We haven’t migrated anything yet, so oldSchemaVersion == 0
if (oldSchemaVersion < 1) {
migration.enumerate(MyClassRealm.className(), { (oldObject, newObject) in
newObject!["remoteId"] = 0
newObject!["deleted"] = false
newObject!["dirty"] = true
newObject!["updated"] = 0
})
}
})
// Tell Realm to use this new configuration object for the default Realm
Realm.Configuration.defaultConfiguration = config
// Now that we've told Realm how to handle the schema change, opening the file
// will automatically perform the migration
do {
let _ = try Realm()
} catch {
TSLog.error(error as NSError)
}
Do you have any idea what is wrong?