IOS/xcode/coredata: Best practice to store userid in app--testing phase -


i developing app interact website through web service supports many users. app user need userid , password synch data. url connection server requires authentication, answers on suggest nsurl credentials or keychain way go. however, initially, want give user , app userid--that persistent can changed when desired--so can things incorporate userid in profile picture names , forth following format used in web app.

ideally, i'd in way don't have repeat work later.

is there best practice storing user's userid in app prior connecting web services?

thanks suggestions.

you can use nsuserdefaults save persistent user data

nsuserdefaults *userdefaults = [nsuserdefaults standarduserdefaults];  [userdefaults setobject:@"12234" forkey:@"userid"];  [userdefaults synchronize]; 

you can user id using

nsstring* userid = (nsstring *) [userdefaults objectforkey:@"userid"]; 

class reference: https://developer.apple.com/library/mac/documentation/cocoa/reference/foundation/classes/nsuserdefaults_class/index.html