Rick Wu
Rick Wu

Reputation: 61

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

Upvotes: 5

Views: 5142

Answers (2)

Jeff Ames
Jeff Ames

Reputation: 1554

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.

Upvotes: 4

Ethan Long
Ethan Long

Reputation: 745

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

Upvotes: 3

Related Questions