I want to display a alert message from viewDidLoad()
method of ViewController.m
instead from viewDidAppear()
method.
Here is m
OK not a bug, the issue is that in viewDidLoad
the view hierarchy is not fully set. If you use viewDidAppear
, then the hierarchy is set.
If you really want to call this alert in viewDidLoad
you can do so by wrapping your presentation call in this GCD block to cause a slight delay, waiting for the next run loop, however I suggest you don't (it's ugly).
dispatch_async(dispatch_get_main_queue(), ^ {
[self presentViewController:alert animated:YES completion:nil];
});