根据 Apple 的 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.
App Extension 有非常严格的内存约束,并且各不相同。
每种应用扩展的最大内存预算是多少?
我可以像 iOS App 一样测试它们吗ios app maximum memory budget ?
最佳答案
我刚刚在 iPad Pro 9.7 上遇到崩溃并显示消息:
Thread 1: EXC_RESOURCE RESOURCE_TYPE_MEMORY (limit=120 MB, unused=0x0)
因此,在 2GB iOS 设备上为 120 MB,但请注意,限制因扩展类型而异。
示例:
Apple 确认网络扩展的 5-6MB
内存限制,自 iOS 10 Beta 2
起提高到 15MB
。这些限制对于某些应用程序来说是不够的
(见 Psiphon3 ticket)。
测试 VPN(网络扩展的 NEPacketTunnelProvider
)产生以下错误:
Thread 1: EXC_RESOURCE RESOURCE_TYPE_MEMORY (limit=15 MB, unused=0x0)
关于iOS App Extension 的最大内存预算,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37361261/