3

In my app Notification Service Extension I do the following things: - get data (in background) from Parse, - write data to file - save data in NSUserDefaults (in a shared container).

Sometimes I get the message: "Terminated due to memory issue". No other information about what causes this.

Anybody experience with this? This strange thing is that it only happens now and then.

1
  • I am suffering the same issue......Have you worked out the problem?
    – N.Lee
    May 12, 2017 at 5:23

1 Answer 1

3

There is a memory limit in notification service extension. You are supposed to use memory less than about 4.5M. So avoid using NSUserDefaults. And Try to save memory you use.

Just learned this today. NSUserDefaults is stored as property list files. And when you read single value from a property list, the whole property list is deserialized at once, causing rapid increasing in memory using. I think that's why reading values from NSUserDefaults in notification service extension causes memory problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.