2014-04-06 138 views
0

我需要更改我的xcdatamodeld,所以我按照此tutorialCoreData燈光遷移問題。

我創建了另一個.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.' 

我錯過了什麼?

+0

在addPersistentStoreWithType期間是否收到錯誤?它是什麼? – Wain

+0

「創作期間」是什麼意思?每當我嘗試調用'[NSEntityDescription insertNewObjectForEntityForName:@「Entity」inManagedObjectContext:managedObjectContext];' – r4id4

+0

實際上我只是添加了這些代碼行,在遷移核心數據之前運行良好,我認爲persistentStoreCoordinator應該像之前。 – r4id4

回答

0

我設法解決,實際上我需要更新我創建的persistentStoreCoordinator來處理iCloud上的數據庫,我使用NSDictionary我稱爲options