2011-05-19 37 views
0

在我的應用程序我有一個UiViecontroller。
當我關閉這個UiViecontroller我做dismissModalViewControllerAnimated在我的背部動作:
[self dismissModalViewControllerAnimated:NO];
該視圖被刪除,但應用程序崩潰與以下日誌。
應用程序崩潰[self dismissModalViewControllerAnimated:NO];

Thread 0 Crashed: 
    0 libobjc.A.dylib     0x34a80464 objc_msgSend + 16 
    1 UIKit       0x341aab5c _UIView + 52 
    2 UIKit       0x341aaaa8 -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 152 
    3 UIKit       0x341aaace -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 190 
    4 UIKit       0x341aaace -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 190 
    5 UIKit       0x341aaace -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 190 
    6 UIKit       0x341aa9fe -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:] + 22 
    7 UIKit       0x341aa6b8 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 304 
    8 UIKit       0x341c1724 -[UIView(Hierarchy) insertSubview:atIndex:] + 32 
    9 UIKit       0x34276c80 -[UIWindowController _transplantView:toSuperview:atIndex:] + 76 
    10 UIKit       0x34274e0e -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 2522 
    11 UIKit       0x342e4368 -[UIViewController _dismissModalViewControllerWithTransition:from:] + 1472 
    12 UIKit       0x342e3868 -[UIViewController dismissModalViewControllerWithTransition:] + 376 
    13 UIKit       0x342e372e -[UIViewController dismissModalViewControllerWithTransition:] + 62 
    14 UIKit       0x342e1662 -[UIViewController dismissModalViewControllerAnimated:] + 86 
    15 KabushikiShimbun    0x0005fd30 -[PDFPageScrollViewController backAction:] (PDFPageScrollViewController.m:1633) 
    16 CoreFoundation     0x35821fe6 -[NSObject(NSObject) performSelector:withObject:withObject:] + 18 
    17 UIKit       0x341c84a6 -[UIApplication sendAction:to:from:forEvent:] + 78 
    18 UIKit       0x342637ae -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 86 
    19 CoreFoundation     0x35821fe6 -[NSObject(NSObject) performSelector:withObject:withObject:] + 18 
    20 UIKit       0x341c84a6 -[UIApplication sendAction:to:from:forEvent:] + 78 
    21 UIKit       0x341c8446 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 26 
    22 UIKit       0x341c8418 -[UIControl sendAction:to:forEvent:] + 32 
    23 UIKit       0x341c816a -[UIControl(Internal) <br>_sendActionsForEvents:withEvent:] + 350 
    24 UIKit       0x341c89c8 -[UIControl touchesEnded:withEvent:] + 336 
    25 UIKit       0x341be34e -[UIWindow _sendTouchesForEvent:] + 362 
    26 UIKit       0x341bdcc8 -[UIWindow sendEvent:] + 256 
    27 UIKit       0x341a8fc0 -[UIApplication sendEvent:] + 292 
    28 UIKit       0x341a8900 _UIApplicationHandleEvent + 5084 
    29 GraphicsServices    0x320c8efc PurpleEventCallback + 660 
    30 CoreFoundation     0x3580f6f8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 20 
    31 CoreFoundation     0x3580f6bc __CFRunLoopDoSource1 + 160 
    32 CoreFoundation     0x35801f76 __CFRunLoopRun + 514 
    33 CoreFoundation     0x35801c80 CFRunLoopRunSpecific + 224 
    34 CoreFoundation     0x35801b88 CFRunLoopRunInMode + 52 
    35 GraphicsServices    0x320c84a4 GSEventRunModal + 108 
    36 GraphicsServices    0x320c8550 GSEventRun + 56 
    37 UIKit       0x341dc322 -[UIApplication _run] + 406 
    38 UIKit       0x341d9e8c UIApplicationMain + 664 
    39 KabushikiShimbun    0x00002800 main (main.m:14) 
    40 KabushikiShimbun    0x000027b4 start + 32 

不明白爲什麼。
有什麼建議嗎?
謝謝。

+0

如果您對答案有任何意見,請更新您的問題或爲該答案添加評論。不要試圖爲此編輯答案。 – Mat 2011-05-19 04:26:04

+0

你是否試圖在目前的控制器釋放dealloc中的任何東西? – 2011-05-19 05:02:32

回答

0

是視圖控制器最初稱爲莫代爾? 例如,你在初步顯示出通過調用沿着線的東西的看法:

[myView presentModalViewController:myViewController animated:NO]; 

如果你不是,那將是什麼造成你死機,應用程序試圖擺脫一個控制器,這不是模態通過dismissModalViewController方法。

+0

你好,謝謝你的快速回復。我正在使用[myView presentModalViewController:myViewController animated:NO];呈現視圖控制器。 – user465125 2011-05-19 04:52:41

0

視圖控制器的父級負責解除其模態視圖控制器。所以,你應該說

[self.parentViewController dismissModalViewControllerAnimated: YES]; 

要了解更多有關呈現,解聘視圖控制器,請參考我的文章here

+0

thanx的建議,但仍然是同樣的問題。 – user465125 2011-05-20 05:33:31

0

確保當你想它要關閉模式視圖控制器沒有在當時公佈。