3

So I added some new properties to some of my models, and in the simulator, simply calling this works:

setSchemaVersion(7, realmPath: Realm.defaultPath) { migration, oldSchemaVersion in
  if oldSchemaVersion < 7 {
    migration.enumerate(ExerciseType.className(), { (oldObject, newObject) -> Void in
      newObject!["weighted"] = true
    })
  }
}

But when I try to run this on the device, it just hangs. I tried commenting out the new migration, and I correctly get the error message that a migration needs to take place (my previous schema version was 6), but when I add the new migration back in, my app just hangs and never actually calls the migration block.

Any ideas what this could be? Is there a way to recover from this without resetting my Realm entirely?

Adam Singer
  • 2,377
  • 3
  • 18
  • 18
  • I'll also add that currently I'm running version 0.93.2 on the Swift 2 branch. I tried upgrading to 0.94.1, but then I got an error saying that I have an "incompatible Realm file format" or something to that effect, both on the simulator and the device – Adam Singer Aug 14 '15 at 19:49
  • Can you share a stack trace of where exactly it appears to be hanging? Thanks! – segiddins Aug 14 '15 at 20:55
  • @segiddins Here you go. https://gist.github.com/adamsinger/e07252684115eb05ddf9 – Adam Singer Aug 14 '15 at 21:46

1 Answers1

3

Can you please update to the latest version of Realm? There was a short window where the Swift 2 branch accidentally required a file format upgrade which could cause this hang, but the released version of Realm (0.94.1) does not have this issue, however the Realm files you created with that unreleased version will be incompatible.

segiddins
  • 4,110
  • 1
  • 17
  • 22