nilMy app needs to run a few checks then maybe display a UIAlertView any time my application becomes active. To do this I have registered for didBecomeActiveNotification and run my check here.
The issue occurs whenever my UIAlertView pops up during the initial launch, it causes the “Applications are expected to have a root view controller at the end of application launch” message. I’m guessing this is happening because UIAlertView is shown before viewDidAppear:.
How should I be triggering my UIAlertView if not in didBecomeActiveNotification?
2012-03-16 12:21:47.238 App[4181:707] viewDidLoad:
2012-03-16 12:21:47.462 App[4181:707] didBecomeActiveNotification:
2012-03-16 12:21:47.793 App[4181:707] Applications are expected to have a root view controller at the end of application launch
2012-03-16 12:21:48.500 App[4181:707] viewDidAppear:
Edit: To trigger this in a new project do the following.
1 New Project -> Single View Application
2 In Viewcontroller.m add the following to viewDidLoad:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didBecomeActiveNotification:) name:UIApplicationDidBecomeActiveNotification object:nil];
3 In ViewController.m add the following method
-(void)didBecomeActiveNotification:(NSNotification *)notification
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:nil delegate:self cancelButtonTitle:@"ok" otherButtonTitles: nil];
[alertView show];
[alertView release];
}
4 Build and Run
Just as i said, no console messages, nor compiler-warning.
Can you confirm that the message is only visible with the alert shown and there’s no such message without an alert ?