Reputation: 35
I was just following a tutorial on CoreData and I ran into a problem. First myApp was crashing, because I didn't name the database right (as in the tutorial), found that through the debugger. But now my program executes past that point fine, but throws the following error:
Error Domain=NSCocoaErrorDomain Code=134100 "The operation couldn’t be completed
That is in the following method:
if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) {
/*
Replace this implementation with code to handle the error appropriately.
abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
Typical reasons for an error here include:
* The persistent store is not accessible;
* The schema for the persistent store is incompatible with current managed object model.
Check the error message to determine what the actual problem was.
If the persistent store is not accessible, there is typically something wrong with the file path. Often, a file URL is pointing into the application's resources directory instead of a writeable directory.
If you encounter schema incompatibility errors during development, you can reduce their frequency by:
* Simply deleting the existing store:
[[NSFileManager defaultManager] removeItemAtURL:storeURL error:nil]
* Performing automatic lightweight migration by passing the following dictionary as the options parameter:
@{NSMigratePersistentStoresAutomaticallyOption:@YES, NSInferMappingModelAutomaticallyOption:@YES}
Lightweight migration will only work for a limited set of schema changes; consult "Core Data Model Versioning and Data Migration Programming Guide" for details.
*/
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
But I can't figure out what is wrong. As much as I understand the error is, that the function I used to crate entries is different from the function that retrieves them, is that correct? If so, how do I fix it? And what other info is needed for you guys to help me in this matter?
I've been breaking my head about this one for hours now :-/
Oh BTW here is the console (or debug window) output:
2014-05-16 16:47:57.380 TimeStamp[884:60b] User clicked Save
2014-05-16 16:47:57.399 TimeStamp[884:60b] Unresolved error Error Domain=NSCocoaErrorDomain Code=134100 "The operation couldn’t be completed. (Cocoa error 134100.)" UserInfo=0xd166b20 {metadata={
NSPersistenceFrameworkVersion = 479;
NSStoreModelVersionHashes = {
Entity = <a8bc66e2 f3ce9700 9c39bc5d 3ea64ca6 69e06023 3cc0f8e1 2768a9d5 5a520a0d>;
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers = (
""
);
NSStoreType = SQLite;
NSStoreUUID = "588B9127-5774-45B3-8BF0-2C5CD0F07321";
"_NSAutoVacuumLevel" = 2;}, reason=The model used to open the store is incompatible with the one used to create the store}, {
metadata = {
NSPersistenceFrameworkVersion = 479;
NSStoreModelVersionHashes = {
Entity = <a8bc66e2 f3ce9700 9c39bc5d 3ea64ca6 69e06023 3cc0f8e1 2768a9d5 5a520a0d>;
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers = (
""
);
NSStoreType = SQLite;
NSStoreUUID = "588B9127-5774-45B3-8BF0-2C5CD0F07321";
"_NSAutoVacuumLevel" = 2;
};
reason = "The model used to open the store is incompatible with the one used to create the store";}
(lldb)
thanks guys!
Upvotes: 1
Views: 1933
Reputation: 1742
you need to remove the app from the simulator or device, and reinstall (just compile) it again.
the reason is that you changed the underlying database structure. so now you must delete the old database. this will result in the database being created again, according to your new specifications. be aware that you need to delete and reinstall the app every time you change your database.
Upvotes: 5