2012-08-15 88 views
0

我有当UISwitcher被改变时执行以下代码:的iOS的UIDatePicker崩溃与(几乎)无限循环

if(switcher.on == YES) { 
    self.pickerView.datePickerMode = UIDatePickerModeDate; 
} 
else { 
    self.pickerView.datePickerMode = UIDatePickerModeTime; 
} 

这导致应用在模拟器崩溃与以下堆栈跟踪:

* thread #1: tid = 0x1f03, 0x027997dc CoreFoundation`CFNumberGetValue + 12, stop reason = EXC_BAD_ACCESS (code=2, address=0xbf7fffec) 
frame #0: 0x027997dc CoreFoundation`CFNumberGetValue + 12 
frame #1: 0x02843d2c CoreFoundation`-[__NSCFNumber longValue] + 76 
frame #2: 0x02843ed1 CoreFoundation`-[__NSCFNumber integerValue] + 33 
frame #3: 0x0a624255 UIKit`-[UIPickerViewAccessibility(SafeCategory) accessibilityContainerElements] + 99 
frame #4: 0x08f61424 UIAccessibility`-[NSObject(AXPrivCategory) accessibilityElementCount] + 34 
frame #5: 0x08f6135b UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityResetContainerElements] + 75 

... 

frame #196418: 0x08f6135b UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityResetContainerElements] + 75 
frame #196419: 0x0a624290 UIKit`-[UIPickerViewAccessibility(SafeCategory) accessibilityContainerElements] + 158 
frame #196420: 0x08f61424 UIAccessibility`-[NSObject(AXPrivCategory) accessibilityElementCount] + 34 
frame #196421: 0x08f6135b UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityResetContainerElements] + 75 
frame #196422: 0x0a624290 UIKit`-[UIPickerViewAccessibility(SafeCategory) accessibilityContainerElements] + 158 
frame #196423: 0x08f61424 UIAccessibility`-[NSObject(AXPrivCategory) accessibilityElementCount] + 34 
frame #196424: 0x08f6135b UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityResetContainerElements] + 75 
frame #196425: 0x0a624465 UIKit`-[UIPickerViewAccessibility(SafeCategory) reloadAllComponents] + 68 
frame #196426: 0x00ca8b18 UIKit`-[UIDatePickerView _updateBitsForDate:forced:andReload:animateIfNeeded:] + 611 
frame #196427: 0x00ca9116 UIKit`-[UIDatePickerView _setDate:animated:forced:] + 372 
frame #196428: 0x00caa13b UIKit`-[UIDatePickerView setDatePickerMode:] + 535 
frame #196429: 0x00ca7669 UIKit`-[UIDatePicker setDatePickerMode:] + 51 
frame #196430: 0x0005ba9b MyApp`-[RRDatePickerViewController switchChanged:] + 283 at RRDatePickerViewController.m:249 
frame #196431: 0x02876e99 CoreFoundation`-[NSObject performSelector:withObject:withObject:] + 73 
frame #196432: 0x00aa914e UIKit`-[UIApplication sendAction:to:from:forEvent:] + 96 
frame #196433: 0x00aa90e6 UIKit`-[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61 
frame #196434: 0x00b4fade UIKit`-[UIControl sendAction:to:forEvent:] + 66 
frame #196435: 0x00b4ffa7 UIKit`-[UIControl(Internal) _sendActionsForEvents:withEvent:] + 503 
frame #196436: 0x00ca3c16 UIKit`-[_UISwitchInternalView _sendActions] + 121 
frame #196437: 0x013cc85d Foundation`__NSFireDelayedPerform + 389 
frame #196438: 0x02849936 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22 
frame #196439: 0x028493d7 CoreFoundation`__CFRunLoopDoTimer + 551 
frame #196440: 0x027ac790 CoreFoundation`__CFRunLoopRun + 1888 
frame #196441: 0x027abd84 CoreFoundation`CFRunLoopRunSpecific + 212 
frame #196442: 0x027abc9b CoreFoundation`CFRunLoopRunInMode + 123 
frame #196443: 0x02cf97d8 GraphicsServices`GSEventRunModal + 190 
frame #196444: 0x02cf988a GraphicsServices`GSEventRun + 103 
frame #196445: 0x00aa6626 UIKit`UIApplicationMain + 1163 
frame #196446: 0x00002732 MyApp`main + 130 at main.m:16 
frame #196447: 0x000026a5 MyApp`start + 53 

有没有人对此有何建议?谢谢。

干杯, Gaz。

+0

这必须发生在你的代码中的其他地方,因为我已经使用了你的代码,它对我来说工作得很好。 – 2012-08-15 15:49:28

+0

你对可达性有什么特别的要求吗?这个对UIAccessibility框架的调用对我来说似乎很奇怪。 – 2012-08-15 16:30:35

+0

如果关闭辅助功能,这仍然会崩溃吗? – 2012-08-15 17:29:53

回答