cessmestreet cessmestreet - 1 year ago 112
iOS Question

How to show iOS Push Notification Popup?

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.

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?

Answer Source

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.