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

标签 ios iphone swift scenekit arkit

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

我做了一些挖掘,似乎“退出代码 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.

关于ios - .scn 模型中的多个节点导致 iMessage 扩展崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52375086/

相关文章:

ios - 核心数据填充在模拟器中但不移动到设备

ios - iOS 10 中的调用阻止功能

iphone - iOS - 在 ARC 下弹出时 ViewController 未被释放

ios - 更改 ADAL iOS Auth 内的 UI 文本色调颜色

ios - AVAudioSession setCategory .allowBluetooth导致崩溃

ios - 如何使用视觉格式语言添加 View 的纵横比?

ios - 如何像 Apple 一样创建带有水平 slider 的 UIAlertController 样式 ActionSheet? (图像)

ios - 单击按钮后获取表格 View 单元格索引

ios - Checkmark 在 UITableVIewCell 中推送单元格内容

iphone - 如何从应用程序目录中的视频中抓取单帧?