When the user opens my app, I want to check for a value stored in the defaults, and if it is not present prompt the user to input a value. The storing/reading of the value appears to be working.
-(void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
NSLog(@"Checking if there is an email address set");
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString * emailAddress = [defaults objectForKey:@"emailAddress"];
if (IsEmpty(emailAddress))
{
NSLog(@"email address is blank, prompting user to enter one..");
self.emailPromptAlert = [[UIAlertView alloc] initWithTitle:@"Alert"
message:@"Enter Email address:"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"OK", nil];
[self.emailPromptAlert setAlertViewStyle:UIAlertViewStylePlainTextInput];
[self.emailPromptAlert setTag:1];
[self.emailPromptAlert show];
}
}
The problem that I have, is when I do a clean install of my app and load for the first time, the alert shows up as expected but there is no keyboard shown, so the user can’t actually type anything.
Clicking the home button then bringing the app back into the foreground again, the same alert is on screen but this time the keyboard is actually showing.
What can I do to make sure the keyboard gets shown the first time?
I am not totally sure, but maybe this could work?
This doesn’t really get to the root of the problem of why it isn’t showing in the first place, but it could be a solution.