Reputation: 416
My map on GMSMapView appears tan in color and never appears. I have tried every suggestion on the internet, including:
Triple checking my API Keys and setting them as follows (note: GooglePlaces does work):
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
GMSPlacesClient.provideAPIKey("MY KEY")
GMSServices.provideAPIKey("MY KEY")
LocationService.sharedLocation.startUpdatingLocation()
return true
}
I have enabled the iOS SDK:
I have added the SDK to the credentials:
I have also triple checked that the bundle ID is correct (again, GooglePlaces does work).
Below is my implementation code which I got from the Google website.
Inside the viewDidLoad I call:
private func initializeMap() {
let camera = GMSCameraPosition.camera(
withLatitude: (currentLocation?.coordinate.latitude)!,
longitude: (currentLocation?.coordinate.longitude)!,
zoom: zoomLevel
)
let mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
mapView.isMyLocationEnabled = true
mapView.delegate = self
self.view = mapView
}
And yet the map does not appear. Any other thoughts?
Upvotes: 3
Views: 2073
Reputation: 58
In my case the problem was I didn't enabled the Maps SDK for iOS in Google Cloud Platform since the instructions of the Getting Started page didn't say anything about this.
So I enabled this going to the Apis & Services page (make sure you have the correct project selected), clicking ENABLE APIS AND SERVICES, then selecting "Maps SDK for iOS" and finally clicking ENABLE.
If the problem is your user doesn't have access to this API you can grant it following this instructions: https://cloud.google.com/endpoints/docs/openapi/enable-api
Upvotes: 1
Reputation: 416
I found the answer to my question myself. I was using GoogleMaps as a shared pod between my SDK and app (just as I was doing this for GooglePlaces). For some reason unbeknownst, likely a bug in Google API, this prevents it from working. When I moved the pod to my app only, it works.
Upvotes: 0