I'm attempting to migrate a Core Data SQLite store in my Mac OS X Leopard app. The migration itself is simple, there's just a couple of changes between the model versions, and there's one custom NSEntityMigrationPolicy
that does a little bit of string manipulation.
99% of the time, this works perfectly. However, occasionally it crashes with EXC_BAD_ACCESS
in objc_assign_strongCast
under migrateStoreFromURL:
type:
options:
withMappingModel:
toDestinationURL:
destinationType:
destinationOptions:
error:
.
At this point, my custom migration policy hasn't been invoked, so I don't think that's causing it. I've also triple checked my mapping model file, and all seems to be well.
The kicker is that if I simply try to migrate the same file again, it normally works fine. I've no idea where to start debugging this, so any pointers would be welcome!
After speaking with DTS, it turns out this is a bug in Core Data on Mac OS X 10.6.
The workaround: Make sure you're not passing in a nil
error to migrateStoreFromURL: type: options: withMappingModel: toDestinationURL: destinationType: destinationOptions: error:
. This should be allowed, but in this case it causes a crash.