Xcode 4.2, iOS 5.0 SDK, iOS Simulator for 4.3.
I'll do the short version of this, in case there's a well-known answer. If we
need to get into code, I'll be glad to supply it.
I added a version to my data model* and added an attribute to one of my
entities. It is Boolean, non-optional, and defaulted to NO.
When I create my NSPersistentStoreCoordinator, I pass
NSMigratePersistentStoresAutomaticallyOption and
NSInferMappingModelAutomaticallyOption, both NSNumber YES, as options to
addPersistentStoreWithType:....
With assertions, I verified that my new attribute is present in the model. The
"~" file appears. I used a third-party SQLite viewer to verify that in the old
database, the attribute is absent, in the new one, it is present.
I do a fetch in the MOC. As it happens, it's on a different entity, but it has
a relationship to the changed entity, and prefetches the relationship. I
verified with that SQLite viewer that an object matching the query is present
in the DB.
The fetch succeeds, but the result is a fault. Attempting to fire the fault by
sending it a valueForKey: simply produces a no-such-key exception (meaning it's
still a fault).
My impression had been that adding an attribute with a default was the
canonical case in which lightweight migration should work. The SQLite tables do
in fact migrate (though I can't speak for the metadata).
Does it in fact not work? Or is there something else I should be frobbing?
— F
* (Hint for Xcode 4 users: The CD documents are obsolete on how to make your
new version the current one. Select the .xcdatamodel_d_ in the Project
navigator, and use the File inspector to select your new version as current. I
haven't found this documented anywhere.)
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]