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
}
}
I'm not sure why but putting "GoogleMaps." in front of all the kGMSTypes (i.e. GoogleMaps.kGMSTypeNormal) fixed the problem.
mapView.mapType = GMSMapViewType(rawValue: 1)!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With