Ios locationmanager没有名为verbosedictionary的成员
当我升级到XCode 6.2时,我的工作代码突然出现了这个错误 “错误: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!,
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
相反)?不太确定,你觉得这样行吗?