sparrowcode / PermissionsKit

Universal API for request permission and get its statuses.
https://x.com/sparrowcode_ios
MIT License
5.64k stars 462 forks source link

Allow Escalating Location Permissions #20

Closed mgt-la closed 7 years ago

mgt-la commented 7 years ago

If a user upon first launch authorizes .locationWhenInUse, and then later, when taking a certain action, needs to authorize .locationAlways, it shows as denied and that they need to change the settings from iPhone App settings. In fact, it is possible to upgrade from here, in-app, without going to the iPhone App Settings. (:

ivanvorobei commented 7 years ago

@mgt-la It's not posssible. If later you need use . locationAlways, you should request it. Apple allows to request location permissions only once

mgt-la commented 7 years ago

It works on PermissionScope which is another Pod like yours and apple has approved it. I just preferred this UX out of the box 🙂

mgt-la commented 7 years ago

Just tested, this works, if you press btn1, accept, then press btn2 and accept.

import UIKit
import Sparrow
import CoreLocation
class ViewController: UIViewController, CLLocationManagerDelegate {

  let manager = CLLocationManager()

  @IBAction func btn1(_ sender: Any) {                
      //SPRequestPermission.dialog.interactive.present(on: self, with: [.locationWhenInUse])
      manager.requestWhenInUseAuthorization()
  }

  @IBAction func btn2(_ sender: Any) {

      //SPRequestPermission.dialog.interactive.present(on: self, with: [.notification,.locationAlways])
      manager.requestAlwaysAuthorization()
  }
}
ivanvorobei commented 7 years ago

@mgt-la I find how do it, in one hour I will update pod

mgt-la commented 7 years ago

🙏🤞😬 😃🏆

ivanvorobei commented 7 years ago

@mgt-la please, say me, need change permission from .always to .whenInUse?

ivanvorobei commented 7 years ago

@mgt-la I am updated pod, you can use it now. Thanks for your help!

mgt-la commented 7 years ago

@IvanVorobei sorry for the late reply- no, will never need to de-escalate back down to .whenInUse once .always is allowed.

Thank you!! You're awesome! This is a great pod and the other parts of Sparrow are a nice addition!