应用程序崩溃,并调用了 [ServicesDaemonManager] 中断处理程序。-[FontServicesDaemonManager 连接]_block_invoke

Pet*_*ann 5 ios swift swiftui

我的应用程序随机崩溃并出现此错误:

 [ServicesDaemonManager] interruptionHandler is called.
 -[FontServicesDaemonManager connection]_block_invoke
Run Code Online (Sandbox Code Playgroud)

(didReceiveMemoryWarning 在错误消息之前触发)

由于随机性,发布代码有点困难。我使用 SwiftUI (UIHostingController)、@ObserverObjects、异步网络调用、转换到其他视图等。

大多数时候一切正常,但有时我遇到了这个错误。然后内存不断增加,直到应用程序崩溃。

我试图修复所有可能的内存泄漏(释放所有图像,[弱自我],...)没有帮助。

我不确定 FontServicesDaemonManager 正在做什么以及它以何种方式参与,但所有字体都使用系统字体:

 .font(Font.system(size: 25 , weight: .regular))
Run Code Online (Sandbox Code Playgroud)

有时此错误也会出现在上述错误之后:

-[UIWindow endDisablingInterfaceAutorotationAnimated:] called on <UIWindow: 0x10aab11a0; frame = (0 0; 375 812); gestureRecognizers = <NSArray: 0x10acb2510>; layer = <UIWindowLayer: 0x10aacbee0>> without matching -beginDisablingInterfaceAutorotation. Ignoring.
Run Code Online (Sandbox Code Playgroud)

任何人都遇到过类似的问题或知道如何解决这个问题?(Xcode 11.6)

小智 1

这个问题通常与约束有关,您的约束肯定存在一些模糊性,这就是您收到此错误的原因。我的集合视图之一也有同样的问题,因为没有为较小的屏幕正确设置约束。再次检查约束,你就可以开始了。