Thinking this should be easy but.
I want the user to input a username and password on the first run.
then I save the them via.
but of course If I check before they are written then BadStuff happens:
is there a way to pre-install a standardUserDefaults forkey
"myLogin" so it won't crash???
Or any other way to figure out if it's the first run and that the Login and password have been set correctly..
thanks
Ian
I want the user to input a username and password on the first run.
then I save the them via.
Code:
(void)demandUserSetup{
// some code to display and get textfields //
// and wait for ok to be pushed //
[[NSUserDefaults standardUserDefaults] setObject:myLoginTextField.text forKey:@"myLogIn"];
[[NSUserDefaults standardUserDefaults] setObject:myPasswordTextField.text forKey:@"myPassWrd"];
}
but of course If I check before they are written then BadStuff happens:
Code:
NSString *userName = [[NSUserDefaults standardUserDefaults]objectForKey:@"myLogIn"]; //<--- crashy part I think
if (!userName){
[self demandUserSetup]
}
is there a way to pre-install a standardUserDefaults forkey
Or any other way to figure out if it's the first run and that the Login and password have been set correctly..
thanks
Ian
Last edited: