I am making an application that has an account linked to it. The first time the app is launched, the user enters their username and password. These details are then stored in NSStrings. What I want to do is, on launch, check whether the username string is empty or contains a username (if the app has launched before). I have the following code:
AppDelegate:
After username and password entry:
How would I go about putting the variable "username" into the NSUserDefault Twitter Username and have it successfully recognise on start-up that there is something stored in Twitter Username?
AppDelegate:
Code:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
NSUserDefaults *twitterUsername = [NSUserDefaults standardUserDefaults];
username = [twitterUsername stringForKey:@"twitter username"];
if(username == nil) {
[self firstTimeWelcomeMessage];
}
[window addSubview:tabBarController.view];
}
After username and password entry:
Code:
username = usernameTextField.text;
password = passwordTextField.text;
How would I go about putting the variable "username" into the NSUserDefault Twitter Username and have it successfully recognise on start-up that there is something stored in Twitter Username?