IOS alerts users to re-authorize open positioning function _ios

Source: Internet
Author: User

One of the least known features of IOS 8 and above is a deep link to application settings that enable users to activate locations, notifications, contacts, cameras, calendars, and health settings based on the needs of the app.

Most applications simply pop up a warning window containing instructions for the operation, such as "Enter settings > Privacy > Position >our_app". For example, the Twitter app has a more elaborate and friendly indication dialog box, so I'll use it as an example (unfortunately most apps will have a very bad version).

I am now writing this post as a frustrated user, hoping that more iOS developers will be able to create direct deep links with user settings, especially if it is easy to operate.

The following is a warning reminder code for a calendar-related application that contains the options for setting up the 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 the Settings to continue. ",
    Preferredstyle:. Alert) Let
  settingsaction = uialertaction (title: "Settings", Style:. Default) {(alertaction) in
    //, 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, just add this code to your app to make deep links to user settings

If Let appSettings = Nsurl (string:uiapplicationopensettingsurlstring) {
  uiapplication.sharedapplication (). OpenURL (appSettings)
}

This is more like an swarm application when the user denies authorization.

When the user clicks on "Open settings", they can easily enter 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 even be unable to continue using the application because the calendar is not authorized. Therefore, my greatest interest is to make it easy for the user to change the permissions in the settings. Again, this applies to many other applications.


The application of this method in iOS 9 system is more effective! The Setup interface will have a return button that can directly return the user to your application. There's no reason to use this method!

The above content is small to introduce the iOS simple to remind users of the new authorization to open the positioning function of all the narrative, I hope you like.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.