CoreData NSPersistentStoreIncompatibleSchemaError in iOS9 Beta 5

When running my app on a phone upgraded to iOS 9 Beta 5 it starts getting core data errors of the format:


(NSException) NSException = name:"NSInvalidArgumentException" reason:"Store <NSSQLCore: 0x7fe1fb9749e0> (URL: file:///PATH_TOSQL.sqlite) cannot hold instances of entity (<NSEntityDescription: 0x7fe1fb96f070>) name MY_ENTITY, managedObjectClassName MY_MODULE.MY_ENTITY, renamingIdentifier MY_ENTITY, isAbstract 0, superentity name (null), properties {\n photoKitID = \"(<NSAttributeDescription: 0x7fe1fb96d030>), name photoKitID, isOptional 0, isTransient 0, entity MY_ENTITY, renamingIdentifier photoKitID, validation predicates (\\n), warnings (\\n), versionHashModifier (null)\\n userInfo {\\n}, attributeType 700 , attributeValueClassName NSString, defaultValue (null)\";\n}, subentities {\n}, userInfo {\n}, versionHashModifier (null), uniquenessConstraints (\n)"


Error Message: "The model configuration used to open the store is incompatible with the one that was used to create the store."


I have tried the following scenarios:

- Installing the app store version of my app on an iPhone 6 Plus upgraded to iOS9 Beta 5

- Installing the app via Xcode 7 Beta 6 and running it on an iPhone 6 Plus

- Running the app on an iOS9 Simulator from Xcode 7 Beta 6


The app works fine on iOS8. It is written in Swift


Also, not sure if it is related, but seeing another error related to accessing data (Photo data):

Aug 28 23:20:00 MY_PHONE kernel[0] <Notice>: Sandbox: MY_PROCESS(517) deny(1) file-read-data /private/var/mobile/Media/DCIM/100APPLE/IMG_0398.JPG


Any help is appreciated. Thanks!

Accepted Answer

I ended up finding a solution.


When calling addPersistentStoreWithType on my NSPersistentStoreCoordinator I was passing "" to the configuration. This worked in iOS8 but appears to not work in iOS9. Updating to the more correct value of nil (since I have no configurations) fixes the issue.

I had a similar situation that was caused by given a name the new new NSPersistentStoreConfiguration before using it to add a store to a coordinator.

CoreData NSPersistentStoreIncompatibleSchemaError in iOS9 Beta 5
 
 
Q