2013-01-16 73 views
2

我有一個客戶使用iPad 2遇到崩潰,我無法再現它。coredata間歇性崩潰[NSEntityDescription entityForName:inManagedObjectContext:]

崩潰報告:

Last Exception Backtrace: 
0 CoreFoundation     0x37a5429e __exceptionPreprocess 
1 libobjc.A.dylib     0x32b3b97a objc_exception_throw 
2 CoreData      0x317438d8 +[NSEntityDescription entityForName:inManagedObjectContext:] 
3 MyApp       0x000fc916 -[DetailViewController fetchedResultsController] (DetailViewController.m:237) 
4 MyApp       0x000fc374 -[DetailViewController addToMySermons] (DetailViewController.m:170) 
5 MyApp       0x000fc080 -[DetailViewController actionSheet:didDismissWithButtonIndex:] (DetailViewController.m:140) 
6 UIKit       0x35db60cc -[UIActionSheet(Private) _popoutAnimationDidStop:finished:] 
7 UIKit       0x35a73aae -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] 
8 UIKit       0x35ae88ca -[UIViewAnimationState animationDidStop:finished:] 
9 QuartzCore      0x30a91bd4 CA::Layer::run_animation_callbacks(void*) 
10 libdispatch.dylib    0x358924b2 _dispatch_client_callout 
11 libdispatch.dylib    0x358971b8 _dispatch_main_queue_callback_4CF$VARIANT$mp 
12 CoreFoundation     0x37a27f36 __CFRunLoopRun 
13 CoreFoundation     0x3799aeb8 CFRunLoopRunSpecific 
14 CoreFoundation     0x3799ad44 CFRunLoopRunInMode 
15 GraphicsServices    0x3989a2e6 GSEventRunModal 
16 UIKit       0x35ab22f4 UIApplicationMain 
17 MyApp       0x000f595a main (main.m:16) 
18 MyApp       0x000f5910 start + 36 

我可以看到,它的發生在+ NSEntityDescription entityForName:inManagedObjectContext:]調用看起來像這樣:

NSEntityDescription *entity = [NSEntityDescription entityForName:@"StoredPage" inManagedObjectContext:self.managedObjectContext]; 

的self.managedObjectContext在傳遞來自UISplitViewController左側的UITableViewController。

這對我和其他成千上萬使用該應用程序的人來說很好,只有這一個人有問題。我們讓他刪除了應用程序,然後重新安裝並重新啓動他的iPad,但沒有任何幫助。

有沒有辦法讓我趕上拋出的實際異常並將其顯示在UIAlertView中,以便我可以看到實際發生了什麼,或者我將不得不獲得他的UDID並給他一個調試版本?

回答

0

您的核心數據模型是否已更改?

當核心數據模型文件與創建數據庫文件時使用的文件不匹配時,我看到一些難以重現和奇​​怪的崩潰。

通過始終創建核心數據模型(模式)的新「版本」最好避免這種情況。

Select the core data model file and in the Editor menu choose Add Model Version...

2

對我來說,問題是,ManagedObjectContext沒有一個持久存儲協調。

要發現拋出的異常的細節我做了以下

NSEntityDescription *entity = nil; @try { // do something entity = [NSEntityDescription entityForName:@"MyEntity" inManagedObjectContext:managedObjectContext]; } @catch (NSException *exception) { // error happened! do something about the error state NSLog(@"exception creating entity for managedobject content MyEntity = %@", exception); return nil; } @finally { // do something to keep the program still running properly }

其中記錄瞭如下:

```

例外創建managedobject內容實體myEntity所= + entityForName:nil不是用於搜索實體名稱'MyEntity'的合法NSPersistentStoreCoordinator

```

我很欣賞這是一個老問題,但我懷疑這並不是一個不常見的問題。

相關問題