[英]Show iOS push notifications as alert popup instead of banner style
I'm registering my app for receiving push notifications from APNS
in application:didFinishLaunchingWithOptions:
method this way: 我正在注册我的应用程序,以便在
application:didFinishLaunchingWithOptions:
程序中接收来自APNS
推送通知application:didFinishLaunchingWithOptions:
方法:
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
The registration is ok and my provider succesfully gets my token, in fact I do receive push notifications, but when my app is not in foreground a banner is displayed. 注册正常,我的提供商成功获取我的令牌,事实上我确实收到推送通知,但当我的应用程序不在前台时,会显示横幅。 I expected an alert to be shown, with 'Close' and 'View' buttons, and I receive the "alert" string in the payload dictionary... what could be happening?
我期望通过“关闭”和“查看”按钮显示警报,并且我在有效负载字典中收到“警报”字符串......可能会发生什么?
Check the phone settings, users can customize how they want Push Notifications to appear on their devices. 检查手机设置,用户可以自定义推送通知在其设备上的显示方式。
You can not change this setting using code (Reference: https://stackoverflow.com/a/9137501/ ) 您无法使用代码更改此设置(参考: https : //stackoverflow.com/a/9137501/ )
However, you may check the current setting and then request the user to change it. 但是,您可以检查当前设置 ,然后请求用户进行更改。
转到Settings->Notifications->select Your App->Alert style(None,Banners,Alert) select Alerts.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.