2

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!

2 Answers 2

2

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.

0

Two things:

  1. Use the tools Apple provides (namely, Instruments) to track down the memory management issue. It might still be somewhere in your own code.
  2. Try to reduce this to a simple, reproducible case and file a bug with Apple.*

I've noticed a lot of issues popping up surrounding 'automatic' migration that have given me serious pause. The only way to get them addressed is to make sure Apple is aware of every one of them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.