core-data-migration

Modifying the Core Data Model Requires New Version Every Time?

元气小坏坏 提交于 2019-12-13 04:00:00
问题 I've been searching around and let me get this straight, every time I change the attributes of my entities, I need to create an entirely new version of my model? I understand that the SQLite database is now out of sync with my data model, but can't I just delete the sql files and re-run my simulator? This is what I've been doing, but it doesn't seem to be working. 回答1: You are correct, any changes to the core data model must be made in a new core data model version. You can avoid having to do

Migrating entities and parent entities

北城余情 提交于 2019-12-13 03:32:02
问题 I have an entity A which has two attributes. Entity B has A as parent and has an additional 3 attributes. The changes in the new version don't affect entities A and B. How can I migrate objects of entity B to a new version of my data model, including the attributes from entity A? I tried using two entity mappings: one for A and one for B, but 'A attributes' aren't migrated. Alternatively I would add A's attributes to the mapping to migrate B, but there I can't selected the right attributes

Updating Application to use Core Data from previous double SQLite only persistent store

旧城冷巷雨未停 提交于 2019-12-13 02:35:10
问题 I'm currently upgrading an older iPhone flashcard application that uses two SQLite dbs (one with read-only questions that can only be updated by app updates, deletion of cards, addition of cards, updates to cards, and another one where user added their own custom cards) to use Core Data instead. The only property for the "Flashcard" object that distinguishes between a read only card and user added card is the "isCustom" property. Here are the steps that I believe are necessary to do this:

Cannot create an NSPersistentStoreCoordinator with a nil model error

好久不见. 提交于 2019-12-12 15:44:44
问题 I have a coreData datamodel file which was running perfectly. Due to some special requirements i deleted the old datamodel file and created another datamodel file with exactly same entities . There is no change in entities from the previous dataModel. I have made this a part of a different bundle and referring it from that bundle. Code for creating the managedObjectModel if (managedObjectModel_ != nil) { return managedObjectModel_; } NSBundle *newBundle = [NSBundle bundleWithURL:[[NSBundle

Custom Policy in my xcmappingmodel will not be executed

风格不统一 提交于 2019-12-12 13:47:38
问题 I'm trying to create a mapping model for my app that has some custom code. Thus I created a xcmappingmodel and I subclassed NSEntityMigrationPolicy and implemented the createDestinationInstancesForSourceInstance method. Further I entered the classname in the Custom Policy field in my mapping model. Unfortunately my code will never be called (tried breakpoints and logs). My store is created with the following options: NSMigratePersistentStoresAutomaticallyOption: YES

CoreData migration in iOS 7

a 夏天 提交于 2019-12-12 08:57:57
问题 Finally got this migration working, it was a big pain. source code Everything works fine in iOS6 but in iOS7 app crash 回答1: Based on your comment and a bug report at http://openradar.io/15555487 I'm guessing that the full message is something like: CoreData: error: failure reading metadata plist with data bytes: <33> Unable to open database. Error: The file couldn’t be opened because it isn’t in the correct format. Info: { NSUnderlyingException = "An error <null> occurred converting the

iCloud: Sync Core Data between IOS and OSX

做~自己de王妃 提交于 2019-12-11 02:43:35
问题 I try to sync core data between IOS and OSX. At both apps I have the same configuration: And the same entitlements: I also use the same code for the store coordinator within the same name for sqlite file and url: NSManagedObjectModel* managedModel = [NSManagedObjectModel mergedModelFromBundles:nil]; NSPersistentStoreCoordinator* storeCooordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:managedModel]; //-> start iCloud dispatch_async(dispatch_get_global_queue

Description of NSManagedObject shows values, but accessing them shows NaN?

孤人 提交于 2019-12-10 23:15:20
问题 I have found here an excellent solution for creating relationships when migrating a model. I came across an odd problem within the model itself. -(BOOL)createRelationshipsForDestinationInstance:(NSManagedObject *)dInstance entityMapping:(NSEntityMapping *)mapping manager:(NSMigrationManager *)manager error:(NSError *__autoreleasing *)error { NSError *superError = nil; BOOL ismappingSuccess = [super createRelationshipsForDestinationInstance:dInstance entityMapping:mapping manager:manager error

Mapping Model nowhere to be found (Cocoa Error 134140)

こ雲淡風輕ζ 提交于 2019-12-10 20:16:26
问题 Basically, I have a Versioned xcdatamodel and I am migrating from V2 to V3 I created a Mapping Model with a custom policy. Once the PersistenStoreCoordinator tries to do its job, I hit a Cocoa Error No. 134140 (can't find mapping model for migration) This Question basically is the same one I'm having but I am using Xcode 4.6.3 Things I have tried: Forcing the xcmappingmodel to reside inside the xcdatamodelId and ensuring my mapping model is not 0kb in size as per the answer of this question

Core Data Migration issue in IOS 8 only , not IOS 9

允我心安 提交于 2019-12-10 16:50:05
问题 I am facing weird IOS app issue for the Core Data migration. Below are the mentioned Logs for your This issue only happens when an IOS8 Device migrates app from lower version to newer version.Note I am already passing this test in IOS9 using the model version light data migration upgrade. Any quick help is much appreciated as its in production. CoreData: error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///xxxxx/Documents/Application.sqlite options:{