APNs is used in the application with the deployment target set to 8.0
. In my application I need to perform some operations in order to determine whether to generate local notification and show it to the user on that moment or not.
When the payload is sent to APNs to generate push notification, application receives push notification whether its in Background or Foreground state and following method gets called.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
Where app generates a local notification.
The problem is that when the application is Terminated/Closed completely/Does not appear in tabs, app does not receive push notification.
- Development certificates are fine because its working in Background/Foreground state.
- Background Mode in
Capabilities
isON
withBackground Fetch
,Remote notifications
checked Push Notifications
isON
inCapabilities
- The Payload contains
aps
which contains"content-avilable" : 1
and other data. - The Payload does not contain
alert
,badge
orsound
parameters
Another confusion here is that I have tried using the auto generated notification way too. Where payload contains alert
, badge
and sound
which generates a auto generated push notification even if the application is terminated.
Other applications like WhatsApp
and GMail
generates notification while the app is terminated.
So the question is how to implement this feature in my application?