iPhone Core Data Lightweight Migration error: reason = "Can't find model for source store";
- by tul697
Steps taken:
1. Added Data Model version:
Changed my XXX.xcdatamodel to XXX.xcdatamodeId with Design - Data Model - Add Model Version.
Set the new XXX 2.xcdatamodel as current version
Added an attribute to XXX 2.xcdatamodel
Added NSMigratePersistentStoresAutomaticallyOption and NSInferMappingModelAutomaticallyOption
like most tutorials, I added the option in the addPersistentStoreWithType.
ran the code and I got this error:
Unresolved error Error Domain=NSCocoaErrorDomain Code=134130 UserInfo=0x146bb80 "Operation could not be completed. (Cocoa error 134130.)", {
URL = file://localhost/Users/tleung/Library/Application%20Support/iPhone%20Simulator/3.0/Applications/B585CDFC-17C3-4A44-84E2-0B75893C46B8/Documents/favorites.sqlite;
metadata = {
NSPersistenceFrameworkVersion = 241;
NSStoreModelVersionHashes = {
City = <70ea1f9f aaa9af29 52d2bfe4 3071d97f 8224f765 d69928d5 e5844120 52742a35;
StationStore = <40d8093a 1d7d00ec 178b4374 36dfc137 ccfa3a88 87e2d467 69e8ae7e d4c49dbb;
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers = (
);
NSStoreType = SQLite;
NSStoreUUID = "9DD342A6-1F68-4997-A097-096DC96D7BF3";
};
reason = "Can't find model for source store";
}
I've also tried
NSString *path = [[NSBundle mainBundle] pathForResource:@"YOURDB" ofType:@"momd"];
NSURL *momURL = [NSURL fileURLWithPath:path];
managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:momURL];
as suggested by other posts with no success. It seems that it can't find ANY of my models... anyone have any idea?