CLLocationManager.authorizationStatus()总是CLAuthorizationStatus.Not确定与swift&objC应用程序

前端之家收集整理的这篇文章主要介绍了CLLocationManager.authorizationStatus()总是CLAuthorizationStatus.Not确定与swift&objC应用程序前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我可以让我的CLLocationManager授权。 (在ios8下swift)
我甚至添加了一个明确的requestAlwaysAuthorization调用(在ios7下我不需要objC)
func finishLaunch() {
    //ask for authorization
    let status = CLLocationManager.authorizationStatus()
    if(status == CLAuthorizationStatus.NotDetermined) {
        self.locationManager.requestAlwaysAuthorization();
    }
    else {
        self.startMonitoring()
    }
    ...
}

回调从未得到任何东西,但NotDermined并没有显示用户的UIAlertView。

func locationManager(manager: CLLocationManager!,didChangeAuthorizationStatus status: CLAuthorizationStatus) {
    if(status == CLAuthorizationStatus.NotDetermined) {
        println("Auth status unkown still!");
    }
    self.startMonitoring()
}

我做错了吗 – 感觉像一个bug,但我想要一些反馈

请记住,NSLocationAlwaysUsageDescription或NSLocationWhenInUseUsageDescription键现在是强制性的,因此您应该将其包含在您的plist中。
原文链接:https://www.f2er.com/swift/320458.html

猜你在找的Swift相关文章