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