I have created a new data model version and set it to current, then I added a new attribute to an existing Entity. After this when I run the code, it is crashing on the addPersistentStoreWithType
and only I can find from the crash is Thread 1: EXC_BAD_ACCESS (code=1, address=0x424531f70)
The below is the code I am getting the crash.
+ (NSPersistentStoreCoordinator *)coordinator:(NSPersistentStoreCoordinator *)coordinator byAddingStoreAtURL:(NSURL *)url configuration:(NSString *)configuration options:(NSDictionary *)options error:(NSError * __autoreleasing*)error {
if (!coordinator) {
return nil;
}
NSError *error1 = nil;
[coordinator addPersistentStoreWithType:EncryptedStoreType configuration:configuration URL:url options:options error:&error1];
if (error1) {
NSLog(@"[ERROR] Problems to initialize persistent store coordinator: %@, %@", error1, [error1 localizedDescription]);
}
return coordinator;
}
This seems like the crash is occurring on addPersistentStoreWithType
This is the stack at the point it crashed:
If I delete the newly added attribute, then it runs without any issue with the newly created data model.
Any hints why is it failing? Any idea will be appreciated.