One of the most unknown features of IOS 8 and later is a deep link to app settings that allows users to authorize settings such as location, notifications, contacts, cameras, calendars, and health, depending on the app's needs.
Most applications simply pop up a warning window with instructions, such as "Go to Settings > Privacy > Location >our_app". For example, Twitter's application has a more refined and friendly indicator dialog, so I'll use it as an example.
Hopefully more iOS developers will be able to set up direct deep links with user settings, especially when it's easy to operate.
The following is a warning reminder code for a calendar-related application that contains the options for setting up a user. I'm trying to include an option to bring the user into the settings.
Func showeventsacessdeniedalert() {
let alertcontroller = uialertcontroller(title: "Sad face emoji!" ,
message: "The calendar permission is 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" , Span class= "crayon-v" >style: . Cancel, handler: Span class= "crayon-v" >nil)
Alertcontroller. Addaction(cancelaction)
Presentviewcontroller(alertcontroller, animated: true, Completion: nil)
}
Again, just add this code to your app to get deep links to user settings
If let appSettings = nsurl(string: uiapplicationopensettingsurlstring) {
UIApplication. Sharedapplication(). OpenURL(appSettings)
}
When the user rejects the authorization, this is more like the swarm application.
When the user clicks on "Open settings", they are able to easily access the interface.
By adding these three lines of code, you can improve the user experience in an important aspect of activating app usage rights. In my case, the user may not be able to continue using the application because the calendar is not authorized. Therefore, my greatest interest is to make it easy for users to change permissions in Settings. Again, this applies to many other applications as well.
Settings for the app