加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

CLLocationManager.authorizationStatus()总是CLAuthorizationSt

发布时间:2020-12-14 05:53:15 所属栏目:百科 来源:网络整理
导读:我可以让我的CLLocationManager授权。 (在ios8下swift) 我甚至添加了一个明确的requestAlwaysAuthorization调用(在ios7下我不需要objC) func finishLaunch() { //ask for authorization let status = CLLocationManager.authorizationStatus() if(status ==
我可以让我的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中。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读