且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

iOS推送通知只显示徽章。需要声音和横幅

更新时间:2022-12-19 21:18:40


$ b 我设置像这样的通知:
  UIUserNotificationSettings * notificationSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil]; 
[[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];

它工作正常。
希望有帮助。


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.

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.