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?
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.
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