首页 > 解决方案 > Xamarin.iOS 应用程序在 iOS 13 上冻结

问题描述

我有 Xamarin Native (iOS/Android) 应用程序。该应用程序在 iOS 12 及更低版本上运行没有问题。如果您在装有 iOS 13 的设备上运行该应用程序,那么它会由于未知原因开始冻结,并且此错误没有明确的重现步骤,它会发生在不同的屏幕上。

这是来自 Visual Studio for Mac 的堆栈跟踪

=================================================================
    Native Crash Reporting
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

=================================================================
    Native stacktrace:
=================================================================
    0x1003ea775 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_dump_native_crash_info
    0x1003de6b5 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_handle_native_crash
    0x1003f19f1 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_sigsegv_signal_handler_debug
    0x10790bb1d - /usr/lib/system/libsystem_platform.dylib : _sigtramp
    0x111ab5e38 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : OBJC_CLASS_$_UIView
    0x122711c6b - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZNSt3__110shared_ptrIN3ggl6BufferEED2Ev
    0x1227397f3 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZNSt3__110shared_ptrIN3ggl12ConstantDataEED2Ev
    0x122c98778 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZNSt3__113__vector_baseIN3ggl19ConstantDataElementEN3geo12StdAllocatorIS2_NS1_9AllocatorEEEED2Ev
    0x122c9850c - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZN3ggl13PipelineSetupD2Ev
    0x1227b3d24 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZN3ggl6Circle17FillPipelineSetupD0Ev
    0x122b3059d - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZNSt3__120__shared_ptr_emplaceIN2md23CircleOverlayRenderableENS_9allocatorIS2_EEE16__on_zero_sharedEv
    0x12281c40b - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZNSt3__110shared_ptrIN2md23CircleOverlayRenderableEED2Ev
    0x1068eff02 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class
    0x1068ff3c9 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : objc_destructInstance
    0x10690598f - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : -[NSObject dealloc]
    0x122b2eb22 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : -[VKVectorOverlayCircle dealloc]
    0x106906116 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : _ZN11objc_object17sidetable_releaseEb
    0x1068eff02 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class
    0x1068ff3c9 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : objc_destructInstance
    0x10690598f - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : -[NSObject dealloc]
    0x101d63e52 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/MapKit.framework/MapKit : -[MKOverlayRenderer dealloc]
    0x101d63d9b - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/MapKit.framework/MapKit : -[MKOverlayPathRenderer dealloc]
    0x106906116 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : _ZN11objc_object17sidetable_releaseEb
    0x100640abd - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : xamarin_release_managed_ref
    0x12a596bbc - Unknown
    0x132b427b9 - Unknown
    0x1003f4dd5 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_jit_runtime_invoke
    0x1005210e7 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_runtime_invoke_checked
    0x100524a6e - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_runtime_invoke
    0x10064a822 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : xamarin_invoke_trampoline
    0x10065257b - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : xamarin_arch_trampoline
    0x100653782 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : xamarin_x86_64_common_trampoline
    0x100dd0d10 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Foundation : __NSThreadPerformPerform
    0x105b2e271 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : _CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION_
    0x105b2e19c - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : __CFRunLoopDoSource0
    0x105b2d974 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : __CFRunLoopDoSources0
    0x105b2867f - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : __CFRunLoopRun
    0x105b27e66 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : CFRunLoopRunSpecific
    0x10ca74bb0 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices : GSEventRunModal
    0x110d41dd0 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : UIApplicationMain
    0x12a4abae2 - Unknown
    0x12a4ab833 - Unknown
    0x12940fae3 - Unknown
    0x12940ffb9 - Unknown
    0x1003f4dd5 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_jit_runtime_invoke
    0x1005210e7 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_runtime_invoke_checked
    0x10052756c - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_runtime_exec_main_checked
    0x100354a22 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_jit_exec
    0x100651a1e - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : xamarin_main
    0x10030f4a7 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : main
    0x107528d29 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdyld.dylib : start
    0x3 - Unknown

=================================================================
    Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x122cb448d):0x122cb447d  48 8b 7f 08 48 85 ff 74 13 48 8b 73 10 48 8b 07  H...H..t.H.s.H..
0x122cb448d  ff 50 10 b8 ad ba ad de 48 89 43 10 48 83 c4 08  .P......H.C.H...
0x122cb449d  5b 5d c3 55 48 89 e5 53 50 48 89 fb 48 8d 05 90  [].UH..SPH..H...
0x122cb44ad  f2 29 00 48 89 07 48 8b 7f 08 48 85 ff 74 0a 48  .).H..H...H..t.H

=================================================================
    Managed Stacktrace:
=================================================================
      at <unknown> <0xffffffff>
      at Foundation.NSObject:xamarin_release_managed_ref <0x000cb>
      at Foundation.NSObject:ReleaseManagedRef <0x0007a>
      at NSObject_Disposer:Drain <0x00392>
      at <Module>:runtime_invoke_void_object <0x001a8>
      at <unknown> <0xffffffff>
      at UIKit.UIApplication:UIApplicationMain <0x00251>
      at UIKit.UIApplication:Main <0x000b2>
      at UIKit.UIApplication:Main <0x00132>
      at MyApp.iOS.Application:Main <0x00202>
      at <Module>:runtime_invoke_void_object <0x001a8>
=================================================================

首先想到的是处理一些 NSObject 的问题(可能存在一些内存泄漏),但奇怪的是,这个问题不会在低版本 iOS 的较慢设备上重现。

请告诉我是否有其他人遇到过类似的问题。对问题的根源是否有任何假设?

标签: iosxamarinxamarin.iosfreezeios13

解决方案


我找到了这个错误的原因,它与 MKMapView 的处置有关。在显示地图的几个屏幕上,我将 Overlays (MKCircle) 和 OverlayRenderers (MKCircleRenderer) 添加到地图中,并且对这些 Overlays 和 OverlayRenderers 的引用包含在私有变量中。所以主要问题是在屏幕处理期间只处理了地图(MKMapView)对象,而不是引用地图覆盖和覆盖渲染器的私有变量。添加显式处理此变量后,此错误已消失。


推荐阅读