documentation seems to say that kCLAuthorizationStatusAuthorizedAlways应该是CLLocationManager.authorizationStatus()可接受的返回值,尽管这样:

  • 不起作用。
  • 与其他可能的值的名称不一致,例如.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确实可以工作,并且指向与.AuthorizedAlways应该相同的整数值(根据Objective-C文档),但已弃用了它。

    关于正确而不是不建议执行的任何建议?

    最佳答案

    .AuthorizedAlways已取代iOS 8.2中的.Authorized。如果您使用的是8.2 SDK或更高版本,请使用.AuthorizedAlways。参见iOS 8.2 API Diffs

    关于ios - 未定义Swift CLAuthorizationStatus.AlwaysAuthorized,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27657804/

    10-12 14:39