iosswiftswift2google-maps-sdk-iosgmsmapview

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
        }
}

Solution

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