蘋果拒絕我的應用程序與崩潰日誌,表明他們已經在iOS 8.0.2的iPhone 6上測試它。我使用相同的iPhone 6和8.0.2測試了我的應用程序,它的工作原理非常完美。我通過iTunesConnect與testflight一起嘗試了它,假設這與蘋果的測試完全相同 - 顯然不是!蘋果拒絕 - 無法重現崩潰
有沒有人有一個想法,我怎麼能解決這個問題(在與審查小組的接觸已經有,但他們無法幫助,因爲他們說他們沒有技術支持,只是測試的應用程序。
我的問題是(從我的角度來看反正怪):它崩潰時,它添加了持久性存儲:
NSError *error = nil;
_persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
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();
}
顯然,它崩潰,因爲我在那裏有abort()
聲明還,但我不確定該怎麼做(即處理該問題 - 只需刪除並嘗試再次添加商店?)
由於它在我的iPhone上完美運行,我假設它不是源代碼中列出的問題之一(如目錄,模型等),我是對嗎? 我現在正苦苦掙扎幾天,任何幫助或想法都不勝感激!
你改變了模型嗎?嘗試安裝舊版本,添加一些數據,然後更新應用程序,也許你有一些數據遷移的問題。 – jcesarmobile 2014-10-06 06:05:29
檢查此鏈接:http://stackoverflow.com/questions/13806849/handling-errors-in-addpersistentstorewithtype – kabarga 2014-10-06 06:10:30
感謝您的意見。我沒有改變模型,當我測試它時它工作正常 - 所以我認爲這不可能是原因。 – Red 2014-10-06 06:14:43