I need to show black screen when user really go to background. (Not applicationWillResignActive).
As a result, I am changing my root view controller like this in applicationDidEnterBackground.
//Before this, there will be Sync web-service call...normally, it is fast..time out is 2 second
dispatch_async(dispatch_get_main_queue(), ^{
UIViewController *vc = [[UIViewController alloc] init];
[vc.view setBackgroundColor:[UIColor blackColor]];
[AppDelegate instance].window.rootViewController = vc;
});
Problem is that it is not working. I thought it is because there is no enough time. So I study about extending background time and still not okay. How shall I do so that I will show black screen when user enter background totally (when user switch app to app, they will see my app as black screen)?
objective c - Proper use of beginBackgroundTaskWithExpirationHandler
Try adding new view to your window rather than changing window's root view controller when app enters background and remove/hide it as per your requirement. Set view's background color as black color. Good luck.