skip to Main Content

enter image description here

Hello.
I’m making an app that organizes the user’s movement records when hiking.
So I want to encourage users to use the Precise Location option all the time.

However, I saw a lot of pop-ups asking me to set location permissions on other apps, but I couldn’t find a pop-up or UX asking me to turn on the Precise Location that was turned off. Is it against Apple's policy to ask for this?

If you don’t violate it, I’d like to know how other apps ask users to turn on their permissions.

Thank you.

2

Answers


  1. You can kindly ask users to enable precise location by presenting an UIAlertController which will contain description why you need it for, and action to navigate to app settings. When they press the action you will navigate to app settings likewise:

    func navigateToSystemSettings() {
        if let settingsUrl = URL(string: UIApplication.openSettingsURLString)  {
            if UIApplication.shared.canOpenURL(settingsUrl) {
                UIApplication.shared.open(settingsUrl, completionHandler: { (success) in
                    print("Settings opened: (success)") // Prints true
                })
            }
        }
    }
    

    Presenting simple UIAlert:

    func presentAlert() {
        let alert = UIAlertController(title: "Precise location", message: "Please enable precise location by tapping location -> precise location", preferredStyle: .alert)
        let action = UIAlertAction(title: "Navigate to settings", style: .default) { _ in
            self.navigateToSystemSettings()
        }
        alert.addAction(action)
        DispatchQueue.main.async {
            self.present(alert, animated: true)
        }
    }
    

    Also prior to displaying UIAlertController it would be nice to present some screenshot with some arrow pointing to "precise location" switch in settings, so it would be more clear what the user should do.

    P.S.
    This navigateToSystemSettings() function should open your App settings. If it only opens the plain "Settings" instead, fix the issue by uploading app to testflight so that it appears among another apps that are presented on bottom of "Settings" app.

    Login or Signup to reply.
  2. You can use CLLocationManager‘s CLAccuracyAuthorization property to determine whether the user has full/reduced accuracy. Note that this is available from iOS 14 / macOS 11.

    switch locationManager.accuracyAuthorization {
        case .fullAccuracy:
            // TODO: handle fullAccuracy
        case .reducedAccuracy:
            // TODO: handle reducedAccuracy - request temporary full accuracy
        @unknown default:
            // TODO: handle default
    }
    

    If the result is .reducedAccuracy, you can use requestTemporaryFullAccuracyAuthorization(withPurposeKey:completion:) to request temporary access to .fullAccuracy.

    Don’t forget to fill in NSLocationTemporaryUsageDescriptionDictionary and use appropriate key in the function above.

    It would look something like this

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search