Behavior of PUSH Notification Actual Machine Tests Using NCMB

Asked 2 years ago, Updated 2 years ago, 127 views

When I test the PUSH notification of ios using the actual machine, the timing of the method called when the cable is connected and disconnected is different. Is this normal behavior?

ios push-notification

2022-09-30 19:06

1 Answers

I think that connecting and disconnecting the cable means foreground or background.
The method called depends on whether it is foreground or background.
https://qiita.com/sxo/items/eab3e2bc9febb57cf37f#%E3%81%9D%E3%81%AE3-push%E9%80%9A%E7%9F%A5%E3%82%92%E5%8F%97%E4%BF%A1%E3%81%99%E3%82%8B

// Receive normal Push notifications
- (void) application: (UIApplication*) application didReceiveRemoteNotification: (NSDictionary*) userInfo {
NSLog(@"pushInfo:%@", [userInfo description]);}

// Background Fetch Receives Background
- (void) application: (UIApplication*) application didReceiveRemoteNotification: (NSDictionary*) userInfo
fetchCompletionHandler: (void
) (^)(UIBackgroundFetchResult)) completionHandler {
NSLog (@"pushInfo in Background: %@", [userInfo description]);
completionHandler (UIBackgroundFetchResultNoData);}


2022-09-30 19:06

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.