2010-08-12 30 views
1

我在這個內部選擇器中有不一致的崩潰。 EXC_BAD_ACCESS是個例外,所以有些東西被破壞了。崩潰很難重現,並且一旦發生,就不能調試,因爲作爲接收器的UIView不能被檢查。有沒有人有任何關於如何調試這次崩潰的建議?我甚至不知道哪個UIView作爲接收器。下面是一個堆棧崩潰,雖然它不是唯一的一個:在內部UIView(CALayerDelegate)actionForLayer

0 0x00396731 in -[UIView(CALayerDelegate) actionForLayer:forKey:]() 
1 0x029a3222 in -[CALayer actionForKey:]() 
2 0x029a084e in actionForKey() 
3 0x029a07b5 in beginChange() 
4 0x029a5487 in CALayer_setter() 
5 0x029a814c in -[CALayer setContentsRect:]() 
6 0x004216c7 in -[UISegment _updateBackgroundImage]() 
7 0x0041d497 in -[UISegment _commonInitWithInfo:position:autosizeText:]() 
8 0x0042119d in -[UISegment initWithInfo:style:size:barStyle:tintColor:position:isDisclosure:autosizeText:]() 
9 0x0041fd1e in -[UISegmentedControl(Static) _createSegmentAtIndex:position:withInfo:]() 
10 0x00423d61 in -[UISegmentedControl _resetForAppearanceChange]() 
11 0x0041dd4d in -[UISegmentedControl initWithCoder:]() 
12 0x00643f97 in UINibDecoderDecodeObjectForValue() 
13 0x006455d2 in -[UINibDecoder decodeObjectForKey:]() 
14 0x005706ff in -[UIRuntimeConnection initWithCoder:]() 
15 0x00570c7a in -[UIRuntimeEventConnection initWithCoder:]() 
16 0x00643f97 in UINibDecoderDecodeObjectForValue() 
17 0x0064388f in UINibDecoderDecodeObjectForValue() 
18 0x006455d2 in -[UINibDecoder decodeObjectForKey:]() 
19 0x0056fa0a in -[UINib instantiateWithOptions:owner:loadingResourcesFromBundle:]() 
20 0x00571ad9 in -[NSBundle(NSBundleAdditions) loadNibNamed:owner:options:]() 
21 0x00400fa6 in -[UIViewController _loadViewFromNibNamed:bundle:]() 
22 0x003ff030 in -[UIViewController loadView]() 
23 0x003fef0a in -[UIViewController view]() 
24 0x00008899 in -[QueueViewManager loadView] (self=0x4a8f900, _cmd=0x20f99c4) at /Users/shaheen/projects/QueueView/Classes/QueueViewManager.m:58 
25 0x003fef0a in -[UIViewController view]() 
26 0x00008c1d in -[QueueViewManager setMainArea:] (self=0x4a8f900, _cmd=0x4557a, r={origin = {x = 0, y = 0}, size = {width = 1024, height = 719}}) at /Users/shaheen/projects/QueueView/Classes/QueueViewManager.m:76 
27 0x000048a5 in -[MainViewController viewDidLoad] (self=0x4c51d60, _cmd=0x20f8069) at /Users/shaheen/projects/QueueView/Classes/MainViewController.m:179 
28 0x003fef85 in -[UIViewController view]() 
29 0x00003590 in -[StartupFlowLogic viewControllerDismissed] (self=0x4c11e40, _cmd=0x45228) at /Users/shaheen/projects/QueueView/Classes/StartupFlowLogic.m:69 
30 0x0000300a in -[SplashScreenViewController dismissComplete] (self=0x4c123d0, _cmd=0x45081) at /Users/shaheen/projects/QueueView/Classes/SplashScreenViewController.m:116 
31 0x0038fd54 in -[UIViewAnimationState sendDelegateAnimationDidStop:finished:]() 
32 0x0038fbe6 in -[UIViewAnimationState animationDidStop:finished:]() 
33 0x029d3933 in run_animation_callbacks() 
34 0x029d37da in CA::timer_callback() 
35 0x02aef7dc in CFRunLoopRunSpecific() 
36 0x02aee8a8 in CFRunLoopRunInMode() 
37 0x0329889d in GSEventRunModal() 
38 0x03298962 in GSEventRun() 
39 0x00371372 in UIApplicationMain() 
+0

您是否曾經找出造成它的原因? – 2012-05-04 11:46:58

回答

4

我寫這個博客,以幫助理解和調試EXC_BAD_ACCESS

http://loufranco.com/blog/files/Understanding-EXC_BAD_ACCESS.html

按照容易爲了

  1. 運行構建和分析 - 你有一個乾淨的構建?看看它在說什麼,但你現在可以忽略泄漏問題 - 尋找將消息發送到已發佈對象的問題

  2. 使用NSZombiesEnabled運行 - 這會使對象永不釋放,然後在發送消息時發出抱怨一個對象的retainCount爲0.

  3. 啓用Guard Malloc,然後使用特殊的GDB命令檢查堆的完整性。問題在於,您需要在崩潰之前逐步完成並找到真正的問題。它可能會在更接近您的問題的其他地方崩潰,但