ios - Saving a Users Data from Scratch -


i have app want user select location first time open app. after select location, want location saved , buttons made available locations. currently, have tried saving user's location, can achieve when in app, however, whenever app closed out old data not load. 2 questions are:

-- how save user's location throughout whole app

-- way recommended call different links based on user's location?

(update): have tried right using nsuserdefaults. here's code.

- (void)viewdidload {     [super viewdidload];      [self userlocationsave];  }         -(void)userlocationsave     {         campuslocation = self.lbluserlocation.text;         self.lbluserlocation.textcolor = [uicolor whitecolor];         [self savedata];     }      -(void)savedata     {         nsstring *savelocation = self.lbluserlocation.text;         nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults];         [defaults setobject:savelocation forkey:@"campuschoice"];         [defaults synchronize];     }      -(void)loaddata     {         nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults];         nsstring *loadstring = [defaults objectforkey:@"campuschoice"];         [self.lbluserlocation settext:loadstring];     } 

i load data in viewdidappear method.

to clarify, campus location nsstring comes view controller user selects persons data.

it seems not saving users app if data not there during next session.

there 2 ways persist data in ios: coredata nsuserdefaults

sounds nsuserdefaults work you. tutorials how save data using nsuserdefaults.

which way recommended call different links based on user's location?

not sure asking here, if clarify, can edit answer.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -