I currently have a UIView in my View Controller which I have changed to a GMSMapView in the Interface Builder, but nothing shows up, as shown in the picture below:
Here is the code that I am using
let lat = 47.07903
let long = -122.961283
let camera = GMSCameraPosition.cameraWithLatitude(lat, longitude: long, zoom: 10)
let map = GMSMapView.mapWithFrame(CGRectZero, camera: camera)
map.myLocationEnabled = true
map.delegate = self
self.mapView.addSubview(map)
let marker = GMSMarker()
marker.position = CLLocationCoordinate2DMake(lat, long)
marker.map = self.mapView
I have declared mapView
as such using drag and drop:
@IBOutlet var mapView: GMSMapView!
Any help here would be much appreciated. I have tried a lot of different things! Thanks!
This worked for me. https://stackoverflow.com/a/47308301/7560912 You probably have not enabled the google maps API. Go to your app-project's dashboard on https://console.developers.google.com and click the "ENABLE APIS AND SERVICES". There, under the MAPS section select "the Google maps sdk for ios" and enable it.
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