應用程序打開時,我打電話給一個UIAlertView中第一件事情,我得到的錯誤Applications are expected to have a root view controller at the end of application launch
錯誤:應用程序預計將有在應用程序啓動的最後一個根視圖控制器
任何想法,爲什麼會發生這種情況
- (void)viewDidLoad
{
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
if([userDefaults stringForKey:@"kUserName"] == nil)
{
NSLog(@"enter a username");
askForUserName = [[UIAlertView alloc] initWithTitle:@"First time here I see!"
message:@"Please enter a username:\n\n"
delegate:self
cancelButtonTitle:@"Done"
otherButtonTitles:nil];
CGRect frame = CGRectMake(48, 70, 200, 20);
usernameField = [[UITextField alloc] initWithFrame:frame];
usernameField.placeholder = @"Username";
usernameField.backgroundColor = [UIColor whiteColor];
usernameField.autocorrectionType = UITextAutocorrectionTypeDefault;
usernameField.keyboardType = UIKeyboardTypeAlphabet;
usernameField.returnKeyType = UIReturnKeyDefault;
usernameField.clearButtonMode = UITextFieldViewModeWhileEditing;
[askForUserName addSubview:usernameField];
[askForUserName show];
} else
{
userName = [userDefaults stringForKey:@"kUserName"];
}
// Do any additional setup after loading the view, typically from a nib.
}