Jonathan Allen Grant Jonathan Allen Grant - 1 year ago 111
iOS Question

Swift: My Google Maps View isn't showing up

I am trying to implement Google Maps SDK into my iOS app for the first time. After following Google's tutorial, Google Maps still does not show up in my view.

Here is my AppDelegate code:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
return true

and here is the code in my View Controller, straight from Google:

var camera = GMSCameraPosition.cameraWithLatitude(-33.86,
longitude: 151.20, zoom: 6)
var mapView = GMSMapView.mapWithFrame(CGRectZero, camera: camera)
mapView.myLocationEnabled = true
mapsView = mapView

var marker = GMSMarker()
marker.position = CLLocationCoordinate2DMake(-33.86, 151.20)
marker.title = "Sydney"
marker.snippet = "Australia" = mapView

However, the view still doesn't show up. I checked my IBOutlet for my view - mapsView - and it is correct. Here is an image of my storyboard:enter image description here

Where the empty view outlined is my maps view. But here it what my app looks like when it runs: enter image description here

Answer Source

I found my answer:

Change the custom class of the view to a GMSMapView in the Storyboard instead of a UIView.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download