【发布时间】:2018-10-18 23:44:25
【问题描述】:
我在 GMSMapView 上的地图呈棕褐色,从不出现。我已经尝试了互联网上的所有建议,包括:
三次检查我的 API 密钥并将它们设置如下(注意:GooglePlaces 确实工作):
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
GMSPlacesClient.provideAPIKey("MY KEY")
GMSServices.provideAPIKey("MY KEY")
LocationService.sharedLocation.startUpdatingLocation()
return true
}
我已启用 iOS SDK:
我已将 SDK 添加到凭据中:
我还三次检查了捆绑 ID 是否正确(同样,GooglePlaces确实有效)。
以下是我从 Google 网站获得的实现代码。
在我调用的 viewDidLoad 内部:
private func initializeMap() {
let camera = GMSCameraPosition.camera(
withLatitude: (currentLocation?.coordinate.latitude)!,
longitude: (currentLocation?.coordinate.longitude)!,
zoom: zoomLevel
)
let mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
mapView.isMyLocationEnabled = true
mapView.delegate = self
self.view = mapView
}
然而地图并没有出现。还有其他想法吗?
【问题讨论】:
标签: swift google-maps google-maps-sdk-ios