I have created these two variables
var googleMap = GMSMapView()
@IBOutlet weak var mapView: UIView!
I'm assigning googleMap to mapView in viewDidLoad()
override func viewDidLoad() {
super.viewDidLoad()
self.mapView = self.googleMap //Throwing error as 'Google Maps SDK for iOS must be initialized via [GMSServices provideAPIKey:...] prior to use'
}
I'm providing key in AppDelegate.swift
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
GMSServices.provideAPIKey("AIzaSyB6aQxEmza-wUpOPU60aREWReRIAEAvrHs")
return true
}
Can anyone point me in the direction to solve this?
You do not assign the GMSMapView to your UIView in that way. Here's how you do it
Change the class of your UIView to GMSMapView
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