问题
I am developing a ios 8 custom keyboard Extension. It run like a charm start.
But I always get "Receive Memory Warning" in Xcode. So my custom keyboard extension will suddenly terminate sometimes.
But I run the custom keyboard in its host app. There don't have any problem. Don't get "Receive Memory Warning" in Xcode. Don't terminate.
Anybody can help me? If app have any limit size for a Extension use?
回答1:
Apple mentions in their App Extension Programming Guide that memory limits for app extensions are significantly lower than limits imposed on foreground apps. Additionally some types of extensions may have lower limits than others.
Apple is not explicit about these memory limits as far as I can tell and it's unclear if they are dependent on the device and how much memory other apps are consuming. But as Ethan mentioned, for keyboard extensions you should aim for less than 30MB to avoid crashing.
It's also important to test the extension when not running in Xcode or using a debug build configuration. It seems that the memory limits for debug builds are much higher.
回答2:
iOS allocates less memory to extensions as they are supposed to be light and do one thing well. I suppose shall try limit memory use under 30mb...
来源:https://stackoverflow.com/questions/25354192/get-terminated-due-to-memory-error-for-ios-8-custom-keyboard-extension