I had the same problem only on real devices with iOS 9.0 and higher.
I ended up defining my own notification:
(this definition should be available worldwide, constants.h or similar)
#define myAppBecameActiveNotif @"Tito, your app is active"
Then, in the implementation of AppDelegate (in most cases, AppDelegate.m), you implement the applicationDidBecomeActive delegate method:
- (void)applicationDidBecomeActive:(UIApplication *)application { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [[NSNotificationCenter defaultCenter] postNotificationName:myAppBecameActiveNotif object:nil]; }); }
(Just a delay in sending your notification a bit so that your components come to life)
Now, in the class you would like to be notified about, the application has become active, you do
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(whatToDoWhenAppActive:) name:myAppBecameActiveNotif object:nil];
Now the work is good. You will see that you cannot feel this delay of 500 ms ...
source share