0
我需要更改我的xcdatamodeld
,所以我按照此tutorial。CoreData燈光遷移問題。
我創建了另一個.mom文件,並將一個屬性添加到以前的某個實體。然後我將其設置在我的AppDelegate
中。
NSDictionary *options = @{
NSMigratePersistentStoresAutomaticallyOption : @YES,
NSInferMappingModelAutomaticallyOption : @YES
};
if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:options error:&error]) ...
我覺得還好,但是當我嘗試與核心數據我的應用程序崩潰互動與此錯誤。
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'This NSPersistentStoreCoordinator has no persistent stores. It cannot perform a save operation.'
我錯過了什麼?
在addPersistentStoreWithType期間是否收到錯誤?它是什麼? – Wain
「創作期間」是什麼意思?每當我嘗試調用'[NSEntityDescription insertNewObjectForEntityForName:@「Entity」inManagedObjectContext:managedObjectContext];' – r4id4
實際上我只是添加了這些代碼行,在遷移核心數據之前運行良好,我認爲persistentStoreCoordinator應該像之前。 – r4id4