且构网

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

如何显示IOS推送通知弹出?

更新时间:2023-02-26 20:56:45


  

重置推送通知警报的权限在iOS


  
  

第一时间推送通知启用推的应用注册,
  iOS的询问用户是否他们希望收到通知的应用程序。
  一旦用户回应此警报它不是$ P $再次psented
  除非该设备恢复或应用程序已被卸载在
  至少一天。


  
  

如果要模拟你的应用程序的第一次运行,你可以离开
  卸载了一天的应用程序。您可以实现后者不
  实际上按照以下步骤等待了一天:

  1。从设备上删除您的应用程序。2.完全关闭设备并重新打开它。3.进入设置>通用及GT;日期和放大器;时间,并设置日期提前一天以上。4.再次完全关闭设备并重新打开它。


块引用>

Source

I'm trying to add push notification to my app. I need to know how to make the push notification popup appear. The popup i'm pertaining to is an alert view that has two choices, "allow" and "don't allow". It asks the user whether to allow the app to receive notifications and stuff or not. Sorry I don't have a screenshot but I hope my description can help. I've tried deleting my app over and over again and advancing the time but nothing worked.

Also, in case the popup appears, how can I know if the user selected don't allow/ allow? Any help would be appreciated. Thanks.

Resetting the Push Notifications Permissions Alert on iOS

The first time a push-enabled app registers for push notifications, iOS asks the user if they wish to receive notifications for that app. Once the user has responded to this alert it is not presented again unless the device is restored or the app has been uninstalled for at least a day.

If you want to simulate a first-time run of your app, you can leave the app uninstalled for a day. You can achieve the latter without actually waiting a day by following these steps:

1. Delete your app from the device.

2. Turn the device off completely and turn it back on.

3. Go to Settings > General > Date & Time and set the date ahead a day or more.

4. Turn the device off completely again and turn it back on.

Source