core-data-migration

Xcode Core Data: Change existing XML to Sqlite (NSXMLStoreType to NSSQLiteStoreType)

独自空忆成欢 提交于 2019-12-22 13:03:12
问题 On my first app I used within my persistant store coordinater a NSXMLStoreType. [storeCooordinator addPersistentStoreWithType:NSXMLStoreType configuration:nil URL:storeURL options:options error:nil]; Now, I like to change to a NSSQLiteStoreType: [storeCooordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:options error:nil]; The app crashes, if I simply change the store type. So what I have to do? May I have to do once: check if the old store exists

how do i remove coredata from iphone

我的梦境 提交于 2019-12-22 08:55:12
问题 You know how you can Reset the coredata store on an iPhone simulator when you've changed your entity structure? Do I need to perform a similar process when I've created a new version of my core data store that is different from what I last ran on my iPhone? If so, how, please? Thanks 回答1: Just for convenience, until you code a way to remove the persistent store through your app, you can just delete the app off the phone. (Hold your finger on the home screen until icons get wiggly, then click

NSRangeException following Core Data migration

孤者浪人 提交于 2019-12-21 17:53:11
问题 After adding a new Core Data model version to my app, I performed a lightweight migration, apparently successfully. The migrated file loaded fine, but upon the first attempt to access an attribute via a particular relationship, the app crashes with an NSRangeException: '*** -[__NSArrayM objectAtIndex:]: index 4294967295 beyond bounds [0 .. 35]' . This relationship worked fine prior to the migration. I know from other posts here that 4294967295 is really -1 , but the only thing I can identify

Core Data lightweight migration: Can't find or automatically infer mapping model for migration

只谈情不闲聊 提交于 2019-12-21 12:11:11
问题 So I created a new version of my data model, and made a previously optional field non-optional (giving it a default value). According to the documentation, this should mean my migration is eligible for lightweight, automatic migration. I also added options that allow this when I open the store, also per the documentation: NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:YES

Core data migration - how to combine two entities into one

拟墨画扇 提交于 2019-12-21 06:22:51
问题 I have a old core data model with two entities: First entity FirstString has an attribute: string1 which is NSString Second entity SecondString has an attribute: string2 which is NSString They have a one to many relationship: first entity <--->> second entity. The new entity - "ComboEntity" - has one to one relationship with both first entity and second entity. Now I have new core data model with new entity ComboEntity has an attribute: fullString Question: How do I migrate the data and

Core Data Migration: How to delete the Core Data stack?

浪子不回头ぞ 提交于 2019-12-21 03:42:51
问题 My plan is to delete the old Core Data stack (the NSManagedObjectModel .momd file & the NSPersistentStore .sqlite file) because: I don't have experience with Core Data migrations. the new .xcdatamodel schema is completely different than the old one. I can safely delete the user's old data because it's all stored on our server and the new app downloads the latest data from our server anyway. In this case, is complete deletion the best way to go about migration? 回答1: It is a perfectly valid

Fix Core Data Fail

亡梦爱人 提交于 2019-12-19 11:54:45
问题 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

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

送分小仙女□ 提交于 2019-12-19 05:59:29
问题 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. 回答1: This is a "function expressions with arbitrary method invocations" which seem to be very poorly documented. The only reference

How many migration steps does Core Data lightweight migration have?

拈花ヽ惹草 提交于 2019-12-13 12:31:58
问题 I use Core Data and lightweight migration for my iPhone app. Suppose I have created 3 versions of the data model for the app. One user installed the early version of my app and its data model version is still v1. When the user update the app to the latest version which has the data model version v1,v2 and v3, what happened during the update? The sqlite database migrate from v1 to v2 first and then migrate from v2 to v3? Or it just jump from v1 to v3? 回答1: Internally, I believe Core Data

iOS application coreData with PersistentStore as static sqlite Data Migration?

Deadly 提交于 2019-12-13 06:05:07
问题 The app is using a static sqlite(initial data) from bundle directory as a persistent store for Coredata. The sqlite has 7 tables of which one table is modified by adding an extra column/field. How does I make coreData understand that the persistent store(store) is changed and it needs to take the new update ? Is there any Model version concept for sqlite like we do for coredata ? 回答1: For those who doesn't want to dig into documentation and is searching for a quick fix: 1>Open your