nsuserdefaults - iOS Saving User Configuration -


i working ios app require user configure part of app , configuration must saved in event user turns on/off part of app. once app backgrounded, users-configuration must removed security purposes.

my question best way save strings , nsintegers temporarily , removing them when time comes.

nsuserdefaults nscache 

i have looked both , unable come solid conclusions. there way missing might better?

thanks! -brian

if want settings available while app in foreground, don't store them in nsuserdefaults. nsuserdefaults persist between app launches , removed when user deletes app.

for temporary storage, consider storing key/value pairs in simple nsmutabledictionary. clear dictionary in application delegate's applicationwillresignactive method ensure values cleared when app moved background.

while nscache key/value store similar dictionary, app clear nscache if receives low memory warnings. store non-critical (re-creatable) data in nscache.


Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -