由于使用 SKGLView 而返回 MainPage 时崩溃

Crashed when back to MainPage because of using SKGLView

SIGABRT: Cannot access a disposed object. Object name: 'SKGLView'.

我们在 MainPage 中使用 SKGLView,有时从另一个视图返回时,会显示此错误并且应用程序崩溃。我不知道,这是 App Center 的日志。

NSObject.get_SuperHandle () /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:471 GLKView.Display () /Users/builder/azdo/_work/1/s/xamarin-macios/src/build/ios/native/GLKit/GLKView.g.cs:152 SKGLViewRenderer+<>c__DisplayClass4_0.b__1 () NSAsyncActionDispatcher.Apply () /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSAction.cs:152 (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr) UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:86 Application.Main (System.String[] args)

最后,我们通过使用代码为 SKGLView 设置 HasRenderLoop 属性 来解决它,而不是 Xaml.

参考link:https://github.com/mono/SkiaSharp/issues/870