这个堆栈跟踪表明了啥? iOS8 上由 Xamarin.Media.MediaPicker.TakePhotoAsync 引起的崩溃
Posted
技术标签:
【中文标题】这个堆栈跟踪表明了啥? iOS8 上由 Xamarin.Media.MediaPicker.TakePhotoAsync 引起的崩溃【英文标题】:What does this stack trace indicate? Crash caused by Xamarin.Media.MediaPicker.TakePhotoAsync on iOS8这个堆栈跟踪表明了什么? iOS8 上由 Xamarin.Media.MediaPicker.TakePhotoAsync 引起的崩溃 【发布时间】:2014-09-11 03:15:33 【问题描述】:此堆栈跟踪表明什么? iPad2 上的 ios8 上由 Xamarin.Media.MediaPicker.TakePhotoAsync 引起的崩溃
我在...记录了一个错误 https://bugzilla.xamarin.com/show_bug.cgi?id=22853
但我想确保这不是我正在做的事情。它在 iOS7 上运行良好。
OS Version: iOS 8.0 (12A365)
Report Version: 105
Exception Type: EXC_BAD_ACCESS (SIGABRT)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000002c
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x3ab05dfc __pthread_kill + 8
1 libsystem_pthread.dylib 0x3ab85d0e pthread_kill + 58
2 libsystem_c.dylib 0x3aaa5934 abort + 72
3 TouchContainer 0x00bd5b3a mono_handle_native_sigsegv (mini-exceptions.c:2360)
4 TouchContainer 0x00bdef72 mono_sigsegv_signal_handler (mini.c:6868)
5 libsystem_platform.dylib 0x3ab800a0 _sigtramp + 40
6 UIKit 0x30212304 _UIViewTopDownSubtreeTraversal + 260
7 UIKit 0x30212304 _UIViewTopDownSubtreeTraversal + 260
8 UIKit 0x305ab842 -[UIView(UIConstraintBasedLayout_EngineDelegate) _invalidateSystemLayoutSizeFittingSizeAtEngineDelegateLevel] + 118
9 UIKit 0x300429c0 -[UIView(AdditionalLayoutSupport) _setNeedsUpdateConstraintsNeedingLayout:] + 68
10 UIKit 0x305aa4e2 -[UIView(AdditionalLayoutSupport) _setSubviewWantsAutolayoutTripWantsAutolayout:] + 206
11 UIKit 0x2ff88588 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1352
12 UIKit 0x2ff88032 -[UIView(Hierarchy) addSubview:] + 26
13 UIKit 0x3024b2a2 __56-[UIPresentationController _transplantView:toSuperview:]_block_invoke + 242
14 UIKit 0x3024af8c -[UIPresentationController _performBlockWithoutTriggeringResponderEvents:] + 96
15 UIKit 0x3024b1a6 -[UIPresentationController _transplantView:toSuperview:] + 78
16 UIKit 0x3024e474 __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke + 768
17 UIKit 0x3024d358 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 148
18 UIKit 0x2fffb916 _applyBlockToCFArrayCopiedToStack + 306
19 UIKit 0x2ff777da _afterCACommitHandler + 454
20 CoreFoundation 0x2caca842 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 18
21 CoreFoundation 0x2cac7f24 __CFRunLoopDoObservers + 272
22 CoreFoundation 0x2cac8326 __CFRunLoopRun + 910
23 CoreFoundation 0x2ca15dac CFRunLoopRunSpecific + 472
24 CoreFoundation 0x2ca15bbe CFRunLoopRunInMode + 102
25 GraphicsServices 0x33d4904c GSEventRunModal + 132
26 UIKit 0x2ffe0efc UIApplicationMain + 1436
27 TouchContainer 0x001d81ec wrapper_managed_to_native_MonoTouch_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 268
28 TouchContainer 0x0018533c MonoTouch_UIKit_UIApplication_Main_string___intptr_intptr (UIApplication.cs:122)
29 TouchContainer 0x001852fc MonoTouch_UIKit_UIApplication_Main_string___string_string (UIApplication.cs:88)
30 TouchContainer 0x000ad800 Touch_Container_Application_Main_string__ (MainClass.cs:84)
31 TouchContainer 0x0036e9b4 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 196
32 TouchContainer 0x00be115c mono_jit_runtime_invoke (mini.c:6730)
33 TouchContainer 0x00c2059a mono_runtime_invoke (object.c:2831)
34 TouchContainer 0x00c242a2 mono_runtime_exec_main (object.c:4088)
35 TouchContainer 0x00c240ea mono_runtime_run_main (object.c:3714)
36 TouchContainer 0x00bcea74 mono_jit_exec (driver.g.c:1009)
37 TouchContainer 0x00c59894 monotouch_main (monotouch-main.m:469)
38 TouchContainer 0x00bb0da0 main (main.armv7.m:65)
39 TouchContainer 0x000a9024 start + 36
【问题讨论】:
【参考方案1】:看来我做错了是从 ActionSheet 的 Clicked 事件中调用 TakePhotoAsync。显示照片选择器时仍显示操作表。在 iOS8 之前,必须有防御性代码在这种明显非法的情况下静默工作。解决方案是在 BeginInvokeOnMainThread 调用中运行 TakePhotoAsync。这会将主线程上的调用排队,并为 ActionSheet 留出一些空间来完成关闭。
【讨论】:
以上是关于这个堆栈跟踪表明了啥? iOS8 上由 Xamarin.Media.MediaPicker.TakePhotoAsync 引起的崩溃的主要内容,如果未能解决你的问题,请参考以下文章
libc++abi.dylib: terminate_handler 意外抛出异常 - 0 堆栈跟踪 iOS7 / iOS 8