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
Post a Comment