2012-08-24 78 views
1

當我點擊一個彈出視圖控制器的按鈕時,我的應用程序(名爲MyLittleApplication)隨機崩潰。 我可以利用一些幫助(找出我應該在哪裏開始尋找)與崩潰日誌:如何閱讀這個iPhone應用程序崩潰日誌

Exception Type: EXC_BAD_ACCESS (SIGSEGV) 
Exception Codes: KERN_INVALID_ADDRESS at 0x600332e0 
Crashed Thread: 0 

Thread 0 name: Dispatch queue: com.apple.main-thread 
Thread 0 Crashed: 
0 libobjc.A.dylib     0x351faf78 objc_msgSend + 16 
1 Foundation      0x37d0a74c NSKVOPendingNotificationCreate + 216 
2 Foundation      0x37d0a652 NSKeyValuePushPendingNotificationPerThread + 62 
3 Foundation      0x37cfc744 NSKeyValueWillChange + 408 
4 Foundation      0x37cd3848-[NSObject(NSKeyValueObserverNotification) willChangeValueForKey:] + 176 
5 Foundation      0x37d55a14 _NSSetPointValueAndNotify + 76 
6 UIKit       0x311f825a -[UIScrollView(Static) _adjustContentOffsetIfNecessary] + 1890 
7 UIKit       0x31215a54 -[UIScrollView setFrame:] + 548 
8 UIKit       0x31215802 -[UITableView setFrame:] + 182 
9 POViO       0x000fcac8 0xf8000 + 19144 
10 UIKit       0x31211b8e -[UIViewController _setViewAppearState:isAnimating:] + 138 
11 UIKit       0x3126b8a8 -[UIViewController beginAppearanceTransition:animated:] + 184 
12 UIKit       0x3121490c -[UINavigationController _startTransition:fromViewController:toViewController:] + 832 
13 UIKit       0x312144fc -[UINavigationController _startDeferredTransitionIfNeeded] + 244 
14 UIKit       0x3125e8e4 _popViewControllerNormal + 184 
15 UIKit       0x3125e712 -[UINavigationController _popViewControllerWithTransition:allowPoppingLast:] + 386 
16 UIKit       0x31242bba -[UINavigationController popToViewController:transition:] + 626 
17 POViO       0x001074e6 0xf8000 + 62694 
18 CoreFoundation     0x374553f6 -[NSObject performSelector:withObject:withObject:] + 46 
19 UIKit       0x311eae00 -[UIApplication sendAction:to:from:forEvent:] + 56 
20 UIKit       0x311eadbc -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 24 
21 UIKit       0x311ead9a -[UIControl sendAction:to:forEvent:] + 38 
22 UIKit       0x311eab0a -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 486 
23 UIKit       0x311eb442 -[UIControl touchesEnded:withEvent:] + 470 
24 UIKit       0x311e9924 -[UIWindow _sendTouchesForEvent:] + 312 
25 UIKit       0x311e9312 -[UIWindow sendEvent:] + 374 
26 UIKit       0x311cf68e -[UIApplication sendEvent:] + 350 
27 UIKit       0x311cef34 _UIApplicationHandleEvent + 5820 
28 GraphicsServices    0x33c11224 PurpleEventCallback + 876 
29 CoreFoundation     0x374cf51c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32 
30 CoreFoundation     0x374cf4be __CFRunLoopDoSource1 + 134 
31 CoreFoundation     0x374ce30c __CFRunLoopRun + 1364 
32 CoreFoundation     0x3745149e CFRunLoopRunSpecific + 294 
33 CoreFoundation     0x37451366 CFRunLoopRunInMode + 98 
34 GraphicsServices    0x33c10432 GSEventRunModal + 130 
35 UIKit       0x311fdcce UIApplicationMain + 1074 
36 MyLittleApplication     0x000f90ae 0xf8000 + 4270 
37 MyLittleApplication     0x000f9048 0xf8000 + 4168 

我懷疑它是與通知中心和UIDeviceOrientationDidChangeNotifications我使用。這是真的還是我看錯了方向?
我打電話

[notificationCenter removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil] 
viewDidUnload

,這shuld夠嗎?

你能告訴我什麼錯誤,我應該開始尋找?

回答

1

這是一個堆棧跟蹤,您可以看到發生崩潰時調用的堆棧方法。 您從底部開始,自己到達頂部並從您的應用搜索方法調用(堆棧跟蹤也包括來自框架的調用(例如-[UIScrollView(Static) _adjustContentOffsetIfNecessary]))。
從您的應用程序調用最上面的方法可能是您的錯誤的原因,你可以看到系統後來嘗試的。

在你的情況下,你可能會打電話給popToViewController,iOS框架會嘗試動畫從一個UIViewController到下一個的轉換。表格視圖設置框架並滾動到contentOffset似乎有問題。

這很可能是由內存錯誤引起的。你可以通過檢查Exception Type: EXC_BAD_ACCESS (SIGSEGV)
得到這個提示EXC_BAD_ACCESS可能暗示你試圖訪問內存中沒有的東西 - >已經發布。

一般來說,我會建議在Xcode中激活exveption斷點: 您是否設置了異常斷點?

  • 得斷點編輯窗格
  • 按一下X在左下角
  • 選擇添加異常斷點

現在,如果發生異常,你應該會看到一個堆棧跟蹤。 Xcode應該在發生崩潰的那一行。

你應該熟悉的第二件事是樂器中的殭屍模式。
你可以在這個video找到一個很好的介紹zombi模式。

+0

滾動是導致問題的原因。很好的描述可能的問題! – DixieFlatline

0

就你而言,你可以看到你有一個EXC_BAD_ACCESS (SIGSEGV)。這意味着你正試圖訪問不在這裏的東西,或者至少在這裏,但現在不在了。如果您可以複製錯誤,請嘗試使用樂器的殭屍模式,它會告訴您它將訪問哪些內容。對於這個問題的解決方案通常是,您過早釋放資源,而您仍然需要資源。

0

您可能希望在方法中拋出一些NSLog語句,以便您可以瞭解出現問題的位置。有時候這些iOS消息可能有點神祕。