简体   繁体   中英

Should Remote notificatgion on iOS trigger push notifications post UIApplicationWillResignActiveNotification?

As if I understand the documentation properly if a Push notification Pop up appears I UIApplicationWillResignActiveNotification should be posted. But it won't.

I have added:

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(pauseGame)
                                                name:UIApplicationWillResignActiveNotification 
                                           object:nil];

to

applicationDidFinishLaunching

UIApplicationWillResignActiveNotification is posted when the app is no longer active and loses focus.

If you want to listen from Remote Notifications you should implement in AppDelegate the following method:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo;

And to manage remote notifications when the app is not running you should manage the launchOptions from

- (BOOL)application:(UIApplication *)application  didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM