core-data-migration

Core Data light migration on OS X

大兔子大兔子 提交于 2019-12-02 21:34:30
问题 I'm using the Xcode 6 document based application with core data template for OS X, which sets up the core data stack behind the scenes (no visible init code). Now I need to perform a simple core data lightweight migration and I have created the new versioned model and activated it. Do I really have to implement the core data stack initialisation by hand just to be able to pass migration permissions? If yes, where should the core data stack be initialised so that it will override the default?

'<…> is not a valid NSFetchRequest.'

时光毁灭记忆、已成空白 提交于 2019-12-02 15:34:16
问题 I am using a custom source expression NSExpression(format: "FETCH(FUNCTION($manager, \"customFetchRequestForSourceEntityNamed:predicateString:\" , \"\(mapping.sourceEntityName!)\", \"TRUEPREDICATE\"), $manager.sourceContext, NO)") for mapping model. The fetch is being executed normally within the custom method, but exception '<...> is not a valid NSFetchRequest.' is thrown somewhere later inside the NSMigrationManager.migrateStore() method. Any clues? 回答1: The expected result type of this

Core Data light migration on OS X

跟風遠走 提交于 2019-12-02 10:56:34
I'm using the Xcode 6 document based application with core data template for OS X, which sets up the core data stack behind the scenes (no visible init code). Now I need to perform a simple core data lightweight migration and I have created the new versioned model and activated it. Do I really have to implement the core data stack initialisation by hand just to be able to pass migration permissions? If yes, where should the core data stack be initialised so that it will override the default? You mentioned in a comment that you're using the document-based app template-- which is a crucial

'<…> is not a valid NSFetchRequest.'

做~自己de王妃 提交于 2019-12-02 09:13:40
I am using a custom source expression NSExpression(format: "FETCH(FUNCTION($manager, \"customFetchRequestForSourceEntityNamed:predicateString:\" , \"\(mapping.sourceEntityName!)\", \"TRUEPREDICATE\"), $manager.sourceContext, NO)") for mapping model. The fetch is being executed normally within the custom method, but exception '<...> is not a valid NSFetchRequest.' is thrown somewhere later inside the NSMigrationManager.migrateStore() method. Any clues? The expected result type of this method is NSFetchRequest , not what the fetch returns. The signature would be - extension NSMigrationManager {

Migrate Persistant Store Crash

一个人想着一个人 提交于 2019-12-02 07:04:24
问题 I have a switch that turns iCloud on or off for an iOS 7 app. iCloud sync works fine. When iCloud is on and I turn it off, I call this code: - (void)migrateiCloudStoreToLocalStore { NSError *error; __weak NSPersistentStoreCoordinator *psc = self.managedObjectContext.persistentStoreCoordinator; NSDictionary *options = @{NSMigratePersistentStoresAutomaticallyOption:@YES, NSPersistentStoreRemoveUbiquitousMetadataOption : @YES}; NSPersistentStore *currentStore = [psc persistentStores][0]; NSLog(@

Migrate Persistant Store Crash

本小妞迷上赌 提交于 2019-12-02 06:21:34
I have a switch that turns iCloud on or off for an iOS 7 app. iCloud sync works fine. When iCloud is on and I turn it off, I call this code: - (void)migrateiCloudStoreToLocalStore { NSError *error; __weak NSPersistentStoreCoordinator *psc = self.managedObjectContext.persistentStoreCoordinator; NSDictionary *options = @{NSMigratePersistentStoresAutomaticallyOption:@YES, NSPersistentStoreRemoveUbiquitousMetadataOption : @YES}; NSPersistentStore *currentStore = [psc persistentStores][0]; NSLog(@"iCloud Store - %@", currentStore); NSLog(@"Local Store - %@", self.store); [psc migratePersistentStore

Fix Core Data Fail

南楼画角 提交于 2019-12-01 13:49:41
I have an app in the app store that uses Core Data and I have to release an update by tomorrow. However, I am experiencing some problems with Core Data.I by mistake made changes to my model in Core Data and now my app is crashing. I tried migrating the data but the app still crashes when I updated it on my iPhone. Is there anyway to fix it? Thank you so much for your help! EDIT: I am trying to add the .mom file to the app but I can not get it into the Bundle: EDIT 2: Do I delete the entirely Planner.xcdatamodeld: You can recover the original Core Data model from the production app's bundle.

property mapping not being associated correctly. Why?

醉酒当歌 提交于 2019-12-01 06:12:47
EDIT 1 While I understand that for this particular scenario (and other alike) I could use the mapping editor alone to migrate my store correctly so that the values in the persistent store don't jump around, but that's not a solution to my current problem but only avoids addressing the root of the problem. I am keen on sticking with my custom migration policy as this will give me a lot of control through the migration process, especially for future scenarious where setting up a custom migration policy will work for me. This is for a long term solution and not just for this scenario. I urge you

property mapping not being associated correctly. Why?

元气小坏坏 提交于 2019-12-01 05:42:06
问题 EDIT 1 While I understand that for this particular scenario (and other alike) I could use the mapping editor alone to migrate my store correctly so that the values in the persistent store don't jump around, but that's not a solution to my current problem but only avoids addressing the root of the problem. I am keen on sticking with my custom migration policy as this will give me a lot of control through the migration process, especially for future scenarious where setting up a custom

iOS: what is the value expression function when migrating coredata relationship?

一曲冷凌霜 提交于 2019-12-01 03:38:55
The function for a relationship is like: FUNCTION($manager, "destinationInstancesForEntityMappingNamed:sourceInstances:","employeesToEmployees",$source.employees") What is this "Function"? How will it be called? Is there any guide introducing to this? I've read Apple's Core Data Model Versioning and Data Migration programming guide but I still don't get this. Martin R This is a "function expressions with arbitrary method invocations" which seem to be very poorly documented. The only reference that I know of is one paragraph in the NSExpression Class Reference : Function Expressions On OS X v10