CLLocationManager.authorizationStatus()始终使用swift& objC应用程序CLAuthorizationStatus.NotDetermined [英] CLLocationManager.authorizationStatus() always CLAuthorizationStatus.NotDetermined with swift&objC app

查看:562
本文介绍了CLLocationManager.authorizationStatus()始终使用swift& objC应用程序CLAuthorizationStatus.NotDetermined的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以让我的CLLocationManager进行授权。 (在ios8下swift)
我甚至添加了一个显式的requestAlwaysAuthorization调用(在ios7下我不需要使用objC)

I just can get my CLLocationManager to authorise. (swift under ios8) I even add an explicit requestAlwaysAuthorization call (which I don't need with objC under ios7)

func finishLaunch() {
    //ask for authorization
    let status = CLLocationManager.authorizationStatus()
    if(status == CLAuthorizationStatus.NotDetermined) {
        self.locationManager.requestAlwaysAuthorization();
    }
    else {
        self.startMonitoring()
    }
    ...
}

回调永远不会得到任何东西,但NotDermined并没有向用户显示UIAlertView。

the callback never gets anything but NotDermined and there is no UIAlertView shown to the user.

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

我是做错了? - 对我来说感觉像个错误,但我想要一些反馈

Am I doing it wrong? -- Feels like a bug to me but I'd like some feedback

推荐答案

请记住 NSLocationAlwaysUsageDescription NSLocationWhenInUseUsageDescription 现在必须使用密钥,因此您应该将其包含在plist中。

Keep in mind that NSLocationAlwaysUsageDescription or NSLocationWhenInUseUsageDescription keys are now mandatory, so you should include that in your plist.

这篇关于CLLocationManager.authorizationStatus()始终使用swift& objC应用程序CLAuthorizationStatus.NotDetermined的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆