Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps ambiguous use of a GMSMapViewType

I just upgraded to Xcode 7.1. When I try to set the mapType of a GMSMapView I get the error Ambiguous use of 'kGMSTypeNormal', Ambiguous use of 'kGMSTypeTerrain', and Ambiguous use of 'kGMSTypeHybrid'.

@IBOutlet weak var mapView: GMSMapView!

func myfunc() {
      if let myMapType = NSUserDefaults.standardUserDefaults().stringForKey(SettingsTableViewController.History.MapType) {
            switch myMapType {
            case "kGMSTypeNormal":
                mapView.mapType = kGMSTypeNormal
            case "kGMSTypeTerrain":
                mapView.mapType = kGMSTypeTerrain
            case "kGMSTypeHybrid":
                mapView.mapType = kGMSTypeHybrid
            default: break
                mapView.mapType = kGMSTypeNormal
            }
        } else {
            mapView.mapType = kGMSTypeNormal
        }
}
like image 617
wxcoder Avatar asked Oct 26 '15 05:10

wxcoder


2 Answers

I'm not sure why but putting "GoogleMaps." in front of all the kGMSTypes (i.e. GoogleMaps.kGMSTypeNormal) fixed the problem.

like image 105
wxcoder Avatar answered Oct 10 '22 19:10

wxcoder


mapView.mapType = GMSMapViewType(rawValue: 1)!
  • kGMSTypeNormal = 1
  • kGMSTypeSatellite = 2
  • kGMSTypeTerrain = 3
  • kGMSTypeHybrid = 4
  • kGMSTypeNone = 5
like image 2
Channel Avatar answered Oct 10 '22 20:10

Channel