IOS reminds users to go to the settings page to re-authorize notification locating and other functions, ios notification
The least unknown feature of iOS 8 and later versions is the deep link with application settings, you can authorize the location, notification, contact, camera, calendar, and health settings as needed by the APP.
Most applications only pop up a warning window containing operation instructions, such as "go to Settings> privacy> location> OUR_APP ". For example, Twitter applications have a more refined and friendly directive dialog box, so I use it as an example (unfortunately, most applications have a very bad version ).
I am writing this post as a frustrated user. I hope more iOS developers can establish a direct deep link with user settings, especially when it is easy to operate.
The following is a calendar-related application warning code, which contains options for users. I am trying to include an option that can bring users into the settings.
12345678910111213141516171819 |
func showEventsAcessDeniedAlert() { let alertController = UIAlertController(title: "Sad Face Emoji!" , message: "The calendar permission was not authorized. Please enable it in Settings to continue." , preferredStyle: .Alert) let settingsAction = UIAlertAction(title: "Settings" , style: .Default) { (alertAction) in // THIS IS WHERE THE MAGIC HAPPENS!!!! if let appSettings = NSURL(string: UIApplicationOpenSettingsURLString) { UIApplication.sharedApplication().openURL(appSettings) } } alertController.addAction(settingsAction) let cancelAction = UIAlertAction(title: "Cancel" , style: .Cancel, handler: nil) alertController.addAction(cancelAction) presentViewController(alertController, animated: true , completion: nil) } |
Again, you only need to add this code to your APP to achieve deep link with user settings.
123 |
if let appSettings = NSURL(string: UIApplicationOpenSettingsURLString) { UIApplication.sharedApplication().openURL(appSettings) } |
When a user rejects authorization, it is more like a Swarm application.
When users click "open settings", they can easily access this interface.
You only need to add these three lines of code to improve the user experience in activating APP permissions. Taking me as an example, users even cannot continue to use the application because the calendar is not authorized. Therefore, my biggest interest is to make it easy for users to change their permissions. Similarly, this applies to many other applications.
This method works better in iOS 9 systems! In the setting interface, a return button is provided to allow the user to return directly to your application. There is no reason not to use this method!