2013-02-20 52 views
0

我嘗試在Core Data中執行到新數據庫模型版本的遷移。映射模型成功通過「無法添加目標存儲」核心數據遷移錯誤

NSMappingModel *mappingModel = [NSMappingModel mappingModelFromBundles:nil 
                  forSourceModel:sourceModel 
                  destinationModel:destinationModel]; 

找到,但在遷移階段

migrationSuccess = [standardMigrationManager migrateStoreFromURL:storeSourceUrl 
                    type:NSSQLiteStoreType 
                   options:sourceStoreOptions 
                 withMappingModel:mappingModel 
                 toDestinationURL:storeDestUrl 
                 destinationType:NSSQLiteStoreType 
                 destinationOptions:destinationStoreOptions 
                    error:&error]; 

返回錯誤

Error Domain=NSCocoaErrorDomain Code=134110 "The operation couldn\u2019t be completed. (Cocoa error 134110.)" UserInfo=0x96f0350 {NSUnderlyingError=0x96d94e0 "The operation couldn\u2019t be completed. (Cocoa error 134100.)", reason=Can't add destination store} 

我以前遇到了遷移許多問題,但沒有一個看上去像這樣。這是什麼原因以及如何解決?

問候,
米哈爾

回答

0

是否是對這個在模擬器或者您以前運行遷移的設備?在運行遷移之前,商店是否已經存在於Documents文件夾中?

+0

我在模擬器上工作。商店(sqlite文件)已經存在於Documents目錄中。 – Kaktusiarz 2013-02-20 07:36:57

0

我認爲問題出在你的模擬器中。嘗試重新啓動它。或者你可以從模擬器中刪除你的應用程序。之後嘗試再次編譯它。

0

答案很簡單。源和目標商店的URL不能相同。

問候,
米哈爾

相關問題