iOS push notifications only showing badges. need sounds and banners too

浪尽此生 提交于 2019-12-13 06:07:33

问题


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.



来源:https://stackoverflow.com/questions/32151446/ios-push-notifications-only-showing-badges-need-sounds-and-banners-too

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!