How to get back Allow Push Notifications dialog after it was dismissed once?
Here's how Apple say you can do it:
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:
Delete your app from the device.
Turn the device off completely and turn it back on.
Go to Settings > General > Date & Time and set the date ahead a day or more.
Turn the device off completely again and turn it back on.
Reset push notification settings for app
Technical Note TN2265: Troubleshooting Push Notifications
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 setting the system clock
forward a day or more, turning the
device off completely, then turning
the device back on.
Update: As noted in the comments below, this solution stopped working since iOS 5.1. I would encourage filing a bug with Apple so they can update their documentation. The current solution seems to be resetting the device's content and settings.
Update: The tech note has been updated with new steps that work correctly as of iOS 7.
- Delete your app from the device.
- Turn the device off completely and turn it back on.
- Go to Settings > General > Date & Time and set the date ahead a day or more.
- Turn the device off completely again and turn it back on.
UPDATE as of iOS 9
Simply deleting and reinstalling the app will reset the notification status to notDetermined
(meaning prompts will appear).
Thanks to the answer by Gomfucius below:
https://stackoverflow.com/a/33247900/704803
Callback Method if user declines Push Notification Prompt?
In iOS 7, when the system's push notification prompt appears, the app becomes inactive and UIApplicationWillResignActiveNotification fires. Similarly when the user responds to the prompt (pressing either Yes or No), the app becomes active again and UIApplicationDidBecomeActiveNotification fires.
So you can listen for this notification, and then hide your loading screen.
Note: While the prompt is displayed, the Home button, Notification Center, and Control Center are disabled so they cannot trigger a false-positive UIApplicationDidBecomeActiveNotification. However if the user presses Lock button it will trigger UIApplicationDidBecomeActiveNotification.
How to run code after showDialog is dismissed in Flutter?
Simply use await
or then
. the code in then
block will be run after the dialog is dismissed.
showDialog(
// Your Dialog Code
).then((val){
Navigator.pop(_context);
});
Related Topics
Swift - Compressing Video Files
Uislider That Snaps to a Fixed Number of Steps (Like Text Size in the iOS 7 Settings App)
Uikeyboardboundsuserinfokey Is Deprecated, What to Use Instead
Back Button Callback in Navigationcontroller in iOS
How to Add Older Version of iOS Sdk in Xcode 4.5
What Exactly Is Init Coder Adecoder
As3 for iOS:How to Serialize an Array and Then Save It
How to Resize Table Cell Based on Textview
How to Programmatically Get iOS Status Bar Height
Programmatically Go Back to Previous Viewcontroller in Swift
Multiline Label in Uistackview
Switching Viewcontrollers with Uisegmentedcontrol in iOS5
How to Get Core Data Object from Specific Object Id
Running Xcodebuild from a Forked Terminal
Change Width of a Uibarbuttonitem in a Uinavigationbar
How to Logout User Using Facebook Authentication Using Swift and iOS