objective c - How to keep information from reseting -


i have check box type application, kinda notes on iphone. when user closes application , double tabs home button , deletes application background, things have typed deleted or reset. thinking of calling [self savecontext]; didn't work. should calling?

you can usual use such nsuserdefaults save information. or, can go route , save information in data structure , write file. there many easy ways of doing this. instance, if want preserve checked value, following:

nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; [defaults setbool:yes forkey:"checked"]; [defaults synchronize]; 

very simple, , can queried across app exits, so:

if( [defaults boolforkey:"checked"] ) {     //do stuff here } 

Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

uitableview - Create and use custom prototype table cells in xamarin ios using storyboard -