2017-03-07 89 views
0

我正面临一个奇怪的错误。该应用程序在Debug和Ad-Hoc等应用程序中工作得很好。当我将应用程序上传到TestFlight时,它会在您下载应用程序并点击“打开”时崩溃。奇怪的是,如果你只是通过操作系统打开应用程序,一切都按预期工作。我做了大量的挖掘工作,并且怀疑这可能与FinishedLaunching事件和我对RemoteNotificationKey的检查有关......但我确实无法确定。我是否需要通过TestFlight处理启动的特殊条件?当通过TestFlight打开时,Xamarin iOS应用程序只会崩溃

我已经象征了崩溃日志并将其粘贴在下面(只是看起来相关的第一部分)。任何帮助将不胜感激。

Date/Time: 2017-03-06 22:45:00.8870 -0500 
Launch Time: 2017-03-06 22:45:00.0333 -0500 
OS Version: iPhone OS 10.0.2 (14A456) 
Report Version: 104 

Exception Type: EXC_CRASH (SIGABRT) 
Exception Codes: 0x0000000000000000, 0x0000000000000000 
Exception Note: EXC_CORPSE_NOTIFY 
Triggered by Thread: 0 

Application Specific Information: 
abort() called 

Filtered syslog: 
None found 

Thread 0 name: tid_a07 Dispatch queue: com.apple.main-thread 
Thread 0 Crashed: 
0 libsystem_kernel.dylib 0x000000018f892014 pthread_kill + 8 
1 libsystem_pthread.dylib 0x000000018f959460 pthread_kill + 112 
2 libsystem_c.dylib 0x000000018f8063f4 abort + 140 
3 GlobalMeetiOS 0x00000001007e15fc mono_handle_native_sigsegv (mini-exceptions.c:2420) 
4 libsystem_platform.dylib 0x000000018f953348 _sigtramp + 52 
5 libsystem_pthread.dylib 0x000000018f959460 pthread_kill + 112 
6 libsystem_c.dylib 0x000000018f8063f4 abort + 140 
7 GlobalMeetiOS 0x00000001008c9530 print_all_exceptions(MonoObject*) (runtime.m:997) 
8 GlobalMeetiOS 0x00000001007e1d34 mono_invoke_unhandled_exception_hook (mini-exceptions.c:2873) 
9 GlobalMeetiOS 0x00000001007e1290 mono_handle_exception_internal (mini-exceptions.c:1798) 
10 GlobalMeetiOS 0x00000001007e0370 mono_handle_exception (mini-exceptions.c:2027) 
11 GlobalMeetiOS 0x00000001007d8e6c mono_arm_throw_exception (exceptions-arm64.c:390) 
12 GlobalMeetiOS 0x0000000100b6d7e8 throw_exception + 168 
13 GlobalMeetiOS 0x0000000101469940 Xamarin_Forms_Platform_iOS_Xamarin_Forms_Platform_iOS_FormsApplicationDelegate_OnActivated_UIKit_UIApplication + 0 
14 GlobalMeetiOS 0x00000001008ced50 GlobalMeetiOS_GlobalMeet_iOS_AppDelegate_FinishedLaunching_UIKit_UIApplication_Foundation_NSDictionary + 412 
15 GlobalMeetiOS 0x0000000100b4eb64 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 244 
16 GlobalMeetiOS 0x00000001007ee290 mono_jit_runtime_invoke (mini-runtime.c:2524) 
17 GlobalMeetiOS 0x000000010084a524 do_runtime_invoke (object.c:2809) 
18 GlobalMeetiOS 0x000000010084a480 mono_runtime_invoke (object.c:2967) 
19 GlobalMeetiOS 0x00000001019e17b4 native_to_managed_trampoline_6(objc_object*, objc_selector*, _MonoMethod**, UIApplication*, NSDictionary*, char const*, char const*, char const*, char const*) (registrar.m:250) 
20 GlobalMeetiOS 0x00000001019e1f4c -[AppDelegate application:didFinishLaunchingWithOptions:] (registrar.m:6765) 
21 UIKit 0x000000019677f42c -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 400 
22 UIKit 0x000000019698fb70 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3524 
23 UIKit 0x00000001969958e0 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1656 
24 UIKit 0x00000001969aa080 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke.3134 + 48 
25 UIKit 0x00000001969928c4 -[UIApplication workspaceDidEndTransaction:] + 168 
26 FrontBoardServices 0x00000001924658bc __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 36 
27 FrontBoardServices 0x0000000192465728 -[FBSSerialQueue _performNext] + 176 
28 FrontBoardServices 0x0000000192465ad0 -[FBSSerialQueue _performNextFromRunLoopSource] + 56 
29 CoreFoundation 0x0000000190872278 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 24 
30 CoreFoundation 0x0000000190871bc0 CFRunLoopDoSources0 + 524 
31 CoreFoundation 0x000000019086f7c0 __CFRunLoopRun + 804 
32 CoreFoundation 0x000000019079e048 CFRunLoopRunSpecific + 444 
33 UIKit 0x00000001967785dc -[UIApplication _run] + 608 
34 UIKit 0x0000000196773360 UIApplicationMain + 208 
35 GlobalMeetiOS 0x0000000100c5fae4 wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr (/:1) 
36 GlobalMeetiOS 0x0000000100be433c Xamarin_iOS_UIKit_UIApplication_Main_string___string_string (UIApplication.cs:63) 
37 GlobalMeetiOS 0x00000001008ceb98 GlobalMeetiOS_GlobalMeet_iOS_Application_Main_string + 28 
38 GlobalMeetiOS 0x0000000100b4eb64 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 244 
39 GlobalMeetiOS 0x00000001007ee290 mono_jit_runtime_invoke (mini-runtime.c:2524) 
40 GlobalMeetiOS 0x000000010084a524 do_runtime_invoke (object.c:2809) 
41 GlobalMeetiOS 0x000000010084c548 mono_runtime_exec_main (object.c:4585) 
42 GlobalMeetiOS 0x000000010084c164 mono_runtime_run_main (object.c:4134) 
43 GlobalMeetiOS 0x00000001007d868c mono_jit_exec (driver.g.c:1048) 
44 GlobalMeetiOS 0x00000001008cd694 xamarin_main (monotouch-main.m:487) 
45 GlobalMeetiOS 0x0000000101a02ef8 main (main.arm64.m:131) 
46 libdyld.dylib 0x000000018f7805b8 start + 4 

Thread 1: 
0 libsystem_kernel.dylib 0x000000018f892a88 __workq_kernreturn + 8 
1 libsystem_pthread.dylib 0x000000018f95536c _pthread_wqthread + 1452 
2 libsystem_pthread.dylib 0x000000018f954db4 start_wqthread + 4 

Thread 2: 
0 libsystem_kernel.dylib 0x000000018f892a88 __workq_kernreturn + 8 
1 libsystem_pthread.dylib 0x000000018f955188 _pthread_wqthread + 968 
2 libsystem_pthread.dylib 0x000000018f954db4 start_wqthread + 4 

Thread 3: 
0 libsystem_pthread.dylib 0x000000018f954db0 start_wqthread + 0 

回答

0

我想通了。事实证明,这是FinishedLaunching事件中launchOptions参数的问题。同样,奇怪的是,这只发生在从TestFlight打开应用程序时。我想在下载应用程序并点击TestFlight的'Open'按钮后,它会导致launchOptions参数具有一定的价值。但是,这在我的其他代码中造成了一些奇怪的行为。

明确违反的代码是检查launchOptions是否为null。我能够找出崩溃的来源,并简单地 - >if(launchOptions!= null){...其余代码在这里...}导致崩溃。

我甚至拿出代码块内的所有代码,应用程序仍然崩溃。然后,我删除了空检查,并且应用程序不再在从TestFlight打开时崩溃。当然,现在只要打开常规方式就会崩溃,因为我在检查launchOption键时没有明确确定launchOptions不为null。

如果有人从Xamarin可以解释这一点,这将是非常有益的。

此修复程序旨在实施处理抛出异常的方法;这篇文章帮助了我: https://forums.xamarin.com/discussion/931/how-to-prevent-ios-crash-reporters-from-crashing-monotouch-apps

从上面的例子中,我基本上包装了所提到的方法内的违规代码......并且一切都像魅力一样工作!

希望这可以帮助别人解决同样的问题。

相关问题