Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift CLAuthorizationStatus.AlwaysAuthorized is not defined

The documentation seems to say that kCLAuthorizationStatusAuthorizedAlways should be an acceptable return from CLLocationManager.authorizationStatus() though this:

  • Does not work.
  • Is inconsistent with the name of the other possible values like .AuthorizedWhenInUse, .Denied & .Determined.

    CLLocationManager.authorizationStatus() == .AuthorizedAlways
    //'CLAuthorizationStatus.Type' does not have a member named 'AuthorizedAlways'
    CLLocationManager.authorizationStatus() == .kCLAuthorizationStatusAuthorizedAlways
    //'CLAuthorizationStatus.Type' does not have a member named 'kCLAuthorizationStatusAuthorizedAlways'
    

.Authorized does work and points to the same integer value as should .AuthorizedAlways (according to the Objective-C documentation), though, it's deprecated.

Any suggestion about a correct, not deprecated, implementation?

like image 742
AsTeR Avatar asked Dec 26 '14 13:12

AsTeR


1 Answers

.AuthorizedAlways has replaced .Authorized in iOS 8.2. If you're using the 8.2 SDK or later, use .AuthorizedAlways. See iOS 8.2 API Diffs

like image 62
Connor Avatar answered Oct 17 '22 22:10

Connor