我创建了这两个变量
var googleMap = GMSMapView()
@IBOutlet weak var mapView: UIView!
Run Code Online (Sandbox Code Playgroud)
我在viewDidLoad()中将googleMap指定给mapView
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'
}
Run Code Online (Sandbox Code Playgroud)
我在AppDelegate.swift中提供密钥
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
GMSServices.provideAPIKey("AIzaSyB6aQxEmza-wUpOPU60aREWReRIAEAvrHs")
return true
}
Run Code Online (Sandbox Code Playgroud)
任何人都可以指出我解决这个问题的方向吗?