There seems to be something missing, but the below code is generating nil values for both title and title1 (even though it launches the right alert type correctly and doesn't indicate any warning or error). What could be the problem with this implementation of UIAlertView?
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"High Score" message:(NSString *)scoreMessage delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; alert.alertViewStyle= UIAlertViewStylePlainTextInput; UITextField *title1 = [alert textFieldAtIndex:0]; [alert show]; title1= [alert textFieldAtIndex:0]; NSString *title = title1.text; NSLog(@"The name is %@",title); NSLog(@"Using the Textfield: %@",[[alert textFieldAtIndex:0] text]);