core-data-migration

How to migrate core data by deleting old one on App Update

时光毁灭记忆、已成空白 提交于 2019-12-05 02:48:32
问题 Hi I'm going to update my iOS app in appstore and this update contains database change so now how to migrate my existing core data by deleting old database of existing version on App update? I have referred Core Data Migration tutorial Core Data Migration Post Unfortunately of no use. Any help is appreciated in advance 回答1: Smith, I presume you have done some schema changes, in the xcdatamodel Always, Add a new Model Version (Select name.xcdatamodeld then Editor->Add model Version) before

How to show migration progress of NSMigrationManager in a UILabel?

隐身守侯 提交于 2019-12-04 20:12:08
I have a lot of binary data on Core Data which I would like to remove and save as files so I setup the code so that it would run a manual migration. The problem is that because I have to pull binary from Core Data and save them to files, the migration process could take a very long time depending on how much data there is. I would like to show a simple progress label so that users wouldn't think that the app is frozen. // app did launch - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { ... // add the progress label self.progressLabel

Core Data migration failure between NSPersistenceFrameworkVersions 251 and 358

孤街醉人 提交于 2019-12-04 19:46:07
I have what appears to be a bug with Core Data in OS X 10.7.1. My data store (NSSQLiteStoreType) is not being automatically migrated correctly. As a side note the exact same Core Data models are used by an iOS version of the app. -> Here is what appears to be happening. Up until the latest release everything has been working fine -- I have 14 revisions of the model -- model 13 has been shipping for quite some time without incident. Recently I updated my app and added a new model so I am at 14 (this is the version now used in the shipping apps). The iOS version works just fine when migrating

Changing Attribute Type in Core Data with NSInferMappingModelAutomaticallyOption

安稳与你 提交于 2019-12-04 17:42:01
问题 I have my Core Data Store and I use the flag 'NSInferMappingModelAutomaticallyOption' so that whenever I make changes to the Core Data Model I first create a new model version, and the changes to the data models are automatically migrated. However, I need to change an attribute type for one of my Entities. When I do this, the automatic migration doesn't seem to work and I get a Core Data error when I try to run my app. Any way of setting this up to continue with the automatic model migration?

core data manual migration

百般思念 提交于 2019-12-04 16:35:57
I'm trying to migrate to a new completely different model in my project. The changes are way too much for a lightweight migration and I think the best way is to iterate through the top level objects and set all the attributes and relationships myself. How can I set up the migration process to be completely manual like this. I've looked into NSMigrationManager which seems to require an NSMappingModel. The only examples and tutorials I've seen use inferredMappingModelForSourceModel:destinationModel:error: which I can't use because it isn't able to infer the mapping model. Am I on the right path

CoreData migration in iOS 7

拜拜、爱过 提交于 2019-12-04 12:36:15
Finally got this migration working, it was a big pain. source code Everything works fine in iOS6 but in iOS7 app crash 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 metadata plist data: <33>"; } Also based on that report, plus your source code: you're almost certainly leaving

Core Data Migration error when migrating between non-consecutive versions

梦想与她 提交于 2019-12-04 12:17:47
问题 The Problem I've got 13 versions of my core data model. I've made 13 mapping models (V1-V2, V2-V3 etc) I've got automatic migration switched on. On migration between two consecutive versions (e.g. V12-V13) the migration works perfectly On migration between two non-consecutive versions (e.g. V11-V13) the migration fails with the error: Can't find mapping model for migration What I've tried Creating a mapping model for every possible combination of versions. This works, but it's a real hassle.

How to simply delete old core data and rebuilt the new one?

家住魔仙堡 提交于 2019-12-04 10:11:08
I tried to migrate coreData to new version, I'm following this step: Add a new Model Version (Select name.xcdatamodeld then Editor->Add model Version) before making any changes, if you have an app already submitted to App Store which is using the earlier model version. Then, Add a new file from Core Data Tab, as Mapping Model Select, Source Model (Model Version which the submitted App is using) Destination Model (Model Version in which you have done the Changes) source But my data mostly are images and app crash because it takes a lot of memory. So I want to delete old data model and its datas

NSRangeException following Core Data migration

人盡茶涼 提交于 2019-12-04 07:40:02
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 with 36 items in my app/data is that there are 36 total entities in the data model (for reference, the

iOS Core Data + iCloud error for addPersistentStoreWithType: You don’t have permission to save the file “store” in the folder

时光怂恿深爱的人放手 提交于 2019-12-03 21:46:15
I've created a Core Data project from scratch, the only change I made is that where the persistent coordinator is adding a store, I'm providing a NSPersistentStoreUbiquitousContentNameKey option: coordinator.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: url, options: [NSPersistentStoreUbiquitousContentNameKey : "coreDataiCloudTestStore"]) and I'm inserting and saving a new managed object at launch. When at launch there is no iCloud account logged in, no problems. While the app is running, I'm logging into iCloud and going back to the app. I'm getting this error: You