I have an application that is enabled to receive remote notification and perform background tasks.
I've set up Background Modes for Background fetch and Remote notifications and I can receive the notifications and perform the background fetch normally when the app is on foreground or background.
The problem is when the application is killed - the notification is not displayed, not even on the notification center, or as a banner, alert, etc. I know that, if the application is killed, it will not be able to perform the background fetch. But I think it should at least display the notification.
On the AppDelegate I have implemented both methods:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
and
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler
And I'm registering for notification using this:
UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound);
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
[[UIApplication sharedApplication] registerForRemoteNotifications];
Can anyone please advise me what could be wrong/missing from my side?