Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get "Terminated due to Memory error" for ios 8 custom keyboard Extension

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?

Terminated due to Memory Error

like image 581
Rick Wu Avatar asked Aug 17 '14 22:08

Rick Wu


2 Answers

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.

like image 136
Jeff Ames Avatar answered Nov 15 '22 00:11

Jeff Ames


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...

like image 32
Ethan Long Avatar answered Nov 15 '22 01:11

Ethan Long