iOS push notifications only showing badges. need s

2019-09-05 12:48发布

问题:

I am currently sending push notifications to 2 different apps using the same methods, but one of them only shows only Badges. If I visit Notifications from Settings it displays only "Badges" instead of "Badges, Sounds, Banners".

I am using the https://github.com/phonegap/phonegap-plugin-push plugin.

I tried reseting so it would ask for first time push request, tried another device, and repeatedly called the plugins init function which calls

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)]

but with the same result.

If I am on the lock screen it shows up. If I check notification center its there.

Thanks.

回答1:

I am setting notification like this:

UIUserNotificationSettings* notificationSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];

It works fine. Hope this help.