Xamarin.iOS 应用程序在 iOS 13 冻结

Xamarin.iOS application freezes on iOS 13

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

这是来自 Visual Studio 的 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.

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

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