.scn 模型中的多个节点导致 iMessage 扩展崩溃

Multiple nodes in .scn model causing iMessage extension to crash

我在 iMessage 扩展中使用 SceneKit,运行 遇到了一个奇怪的问题。我正在尝试使用混合形状锚将自定义 scn 模型和装配节点渲染到用户的面部表情。我能够在 iOS 应用程序中成功完成此 iMessage 扩展程序的诞生,没有任何问题。但是,一旦放入 MessageViewController 中,每次我尝试 运行 时,程序都会以代码 0 退出。

我做了一些挖掘,似乎 "exited with code 0" 表明内存过载,所以我开始研究我的模型节点。我发现如果我删除除一个节点以外的所有节点,我就可以使用相应的混合形状为该节点设置动画。任何一个以上的节点都会崩溃。

有人知道为什么会这样吗?或者有任何证据表明 iMessage 扩展在被杀死之前只被授予一定数量的处理能力(我的另一个理论)?

感谢任何帮助!

App Extension Programming Guide 我们了解到

Memory limits for running app extensions are significantly lower than the memory limits imposed on a foreground app. On both platforms, the system may aggressively terminate extensions because users want to return to their main goal in the host app. Some extensions may have lower memory limits than others: For example, widgets must be especially efficient because users are likely to have several widgets open at the same time.

Your app extension doesn’t own the main run loop, so it’s crucial that you follow the established rules for good behavior in main run loops. For example, if your extension blocks the main run loop, it can create a bad user experience in another extension or app.

Keep in mind that the GPU is a shared resource in the system. App extensions do not get top priority for shared resources; for example, a Today widget that runs a graphics-intensive game might give users a bad experience. The system is likely to terminate such an extension because of memory pressure. Functionality that makes heavy use of system resources is appropriate for an app, not an app extension.

一个选择可能是尝试优化 DCC 中的几何形状,这样您就不会 运行 进入系统资源限制。