I've added functionality for receiving remote notifications yet the behaviour is really weird. When the application is in a foreground, the method
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
is being called. Although when the app is in the background — nothing shows up. I do not see the banner with incoming notification's message and nothing appears in Notifications swipe down list.
One more weird thing — the application doesn't show up in device's Settings --> Notification apps list. Is it ok that I receive them at all? Even if it is only when in the background?
Has anyone faced similar issues?
Solved that stuff myself finally — I didn't call registerUserNotificationSettings
, so no types of notifications were allowed. Now I do this:
[application registerForRemoteNotifications];
UIUserNotificationType types = UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert;
UIUserNotificationSettings *mySettings = [UIUserNotificationSettings settingsForTypes:types categories:nil];
[application registerUserNotificationSettings:mySettings];
Works perfectly!