-2

My working code is suddenly giving this error when I upgraded to XCode 6.2

"ERROR: locationmanager does not have a member named verbosedictionary"

This is the line in which it is throwing error: verboseMessage = verboseMessageDictionary[verboseKey]!

------------------ Reference code in 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]!
A.Goutam
  • 3,422
  • 9
  • 42
  • 90

1 Answers1

0

For some reason the latest version of Swift has changed CLAuthorizationStatus.Authorized to CLAuthorizationStatus.AuthorizedAlways and this introduced an error in the declaration of verboseMessageDictionary in LocationManager.swift

After making that change, the error got fixed. This happens when you have LocationManager and upgrade to XCode 6.2

Hope this helps others!

private let verboseMessageDictionary = [CLAuthorizationStatus.NotDetermined:"You have not yet made a choice with regards to this application.", CLAuthorizationStatus.Restricted:"This application is not authorized to use location services. Due to active restrictions on location services, the user cannot change this status, and may not have personally denied authorization.", CLAuthorizationStatus.Denied:"You have explicitly denied authorization for this application, or location services are disabled in Settings.", CLAuthorizationStatus.Authorized:"App is Authorized to use location services.",CLAuthorizationStatus.AuthorizedWhenInUse:"You have granted authorization to use your location only when the app is visible to you."]