Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google maps display a gray background when its renderer

I'm trying to implement a simple google maps using swift. The map should be displayed in a UIView.

Well, I follow the next steps: I added a UIView element in my storyboard with the class GMSMapView

And declared in my ViewController with:

@IBOutlet weak var mapView: GMSMapView!

override func viewDidLoad() {
        super.viewDidLoad()

            let camera = GMSCameraPosition.camera(withLatitude: 51.050657, longitude: 10.649514, zoom: 5.5)
            let map = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
            self.mapView = map


        }

And GMSServices.provideAPIKey("xxx-xxx") in my AppDelegate.swift.

Ok, those codes aren't returning any error, but in my screen it's displayed the Google text in colors and a gray background without the map.

What I'm doing wrong?

like image 817
Benjamin RD Avatar asked Dec 02 '22 13:12

Benjamin RD


1 Answers

This issue occur when the Google Maps SDK is not enable for your API Key . For enabling it , open your developer console at https://console.developers.google.com . On the left handside select library. Select Google Map SDK for iOS under Google Maps Api heading and click enable for enabling the Google Map SDK . That's it , you will now have your same old beautiful maps.

like image 161
osama Avatar answered Jan 04 '23 07:01

osama