Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/94.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios locationmanager没有名为verbosedictionary的成员_Ios_Swift_Locationmanager - Fatal编程技术网

Ios locationmanager没有名为verbosedictionary的成员

Ios locationmanager没有名为verbosedictionary的成员,ios,swift,locationmanager,Ios,Swift,Locationmanager,当我升级到XCode 6.2时,我的工作代码突然出现了这个错误 “错误:locationmanager没有名为verbosedictionary的成员” 这是它抛出错误的行: verboseMessage=verboseMessageDictionary[verboseKey] ------------------LocationManager.swift中的参考代码 internal func locationManager(manager: CLLocationManager!,

当我升级到XCode 6.2时,我的工作代码突然出现了这个错误

“错误:locationmanager没有名为verbosedictionary的成员”

这是它抛出错误的行:
verboseMessage=verboseMessageDictionary[verboseKey]

------------------LocationManager.swift中的参考代码

internal func locationManager(manager: CLLocationManager!,
        didChangeAuthorizationStatus status: CLAuthorizationStatus) {
            var hasAuthorised = false
            var verboseKey = status
            switch status {
            case CLAuthorizationStatus.Restricted:
                locationStatus = "Restricted Access"
            case CLAuthorizationStatus.Denied:
                locationStatus = "Denied access"
            case CLAuthorizationStatus.NotDetermined:
                locationStatus = "Not determined"
            default:
                locationStatus = "Allowed access"
                hasAuthorised = true
            }

        verboseMessage = verboseMessageDictionary[verboseKey]!

出于某种原因,最新版本的Swift已将CLAuthorizationStatus.Authorized更改为CLAuthorizationStatus.authorizationDalways,这在LocationManager.Swift中的verboseMessageDictionary声明中引入了错误

internal func locationManager(manager: CLLocationManager!,
        didChangeAuthorizationStatus status: CLAuthorizationStatus) {
            var hasAuthorised = false
            var verboseKey = status
            switch status {
            case CLAuthorizationStatus.Restricted:
                locationStatus = "Restricted Access"
            case CLAuthorizationStatus.Denied:
                locationStatus = "Denied access"
            case CLAuthorizationStatus.NotDetermined:
                locationStatus = "Not determined"
            default:
                locationStatus = "Allowed access"
                hasAuthorised = true
            }

        verboseMessage = verboseMessageDictionary[verboseKey]!
在做出更改后,错误得到了修复。当您有LocationManager并升级到XCode 6.2时,就会发生这种情况

希望这能帮助别人

private let verboseMessageDictionary=[CLAuthorizationStatus.NotDetermined:“您尚未对此应用程序做出选择。”, CLAuthorizationStatus.Restricted:“此应用程序未被授权使用位置服务。由于位置服务的活动限制,用户无法更改此状态,并且可能未亲自拒绝授权。”, CLAuthorizationStatus.Denied:“您已明确拒绝对此应用程序的授权,或者在设置中禁用了位置服务。”,
CLAuthorizationStatus.Authorized:“应用程序被授权使用位置服务。”,CLAuthorizationStatus.authorizedWhenuse:“只有当应用程序对您可见时,您才被授权使用您的位置。”]

什么是
verbosedictionary
(与
verboseMessageDictionary
相反)?不太确定,你觉得这样行吗?