Google 地图不 showing/loading ios

Google Maps not showing/loading ios

我开始使用 google 地图,首先它显示地图,但在它什么都不显示之后我的日志显示这个

CoreData:注释:无法在路径'/var/containers/Bundle/Application/EA2D4483-D98A-4D23-AFE4-ACDD86C0DF2A/Key Sensor.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo 加载优化模型 CoreData:注释:无法在路径 '/var/containers/Bundle/Application/EA2D4483-D98A-4D23-AFE4-ACDD86C0DF2A/Key Sensor.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo' 加载优化模型 CoreData:注释:无法在路径“/var/containers/Bundle/Application/EA2D4483-D98A-4D23-AFE4-ACDD86C0DF2A/Key Sensor.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo'

加载优化模型

我尝试过的东西

我在 api 控制台中限制了包 ID。 我还尝试删除 StorageWithTileProto.omo 文件。 我清理了几次项目。 我重新启动了 phone 几次。 我还创建了新项目,显示相同的错误。

这是我的代码

import Foundation
import UIKit
import GoogleMaps

class GoogleMaps :UIViewController {

 var gsmMapView: GMSMapView!



@IBOutlet weak var mapView: UIView!

let loacationManager = CLLocationManager()

override func viewDidLoad() {

    navigationController?.navigationBar.barTintColor =  
  UIColor.hexStringToUIColor(hex: "#555555")

    loacationManager.delegate = self

    loacationManager.requestAlwaysAuthorization()




    // Zoom to location
    let camera = GMSCameraPosition.camera(withLatitude: 0,
                                          longitude: 0, zoom: 6.0)
    // get google Maps
    gsmMapView = GMSMapView.map(withFrame: CGRect.zero, camera: 
    camera)
    mapView.addSubview(gsmMapView)

    }

   func toast(message msg: String) 
   {self.navigationController?.view.makeToast(message: msg)}
    }


extension GoogleMaps : CLLocationManagerDelegate{

func locationManager(_ manager: CLLocationManager, 
didChangeAuthorization status: CLAuthorizationStatus) {

    print("status \(status.rawValue)")
    if(status != CLAuthorizationStatus.authorizedAlways){

        permissionDialog()
        return
    }
    loacationManager.startUpdatingLocation()





}

func locationManager(_ manager: CLLocationManager, didUpdateLocations 
 locations: [CLLocation]) {

    toast(message: "didUpdateLocations")
    guard let location = locations.first else {
        return
    }

    // 7
    //        gsmMapView.camera = GMSCameraPosition(target: 
           location.coordinate,
       //       zoom: 15, bearing: 0, viewingAngle: 0)
    //        
    // 8
    loacationManager.stopUpdatingLocation()
}

func locationManager(_ manager: CLLocationManager, 
  monitoringDidFailFor region: CLRegion?, withError error: Error) {
    print("Monitoring failed for region with identifier: \ . 
     (region!.identifier)")
 }

func locationManager(_ manager: CLLocationManager, didFailWithError 
 error: Error) {
    print("Location Manager failed with the following error: \ . 
 (error)")
}


func permissionDialog() {
    self.toast(message: "Give Always Authorization Premission")

    let alertController = UIAlertController(title: "Permission",
                                            message: "Please go to 
  Settings and turn on the location alway               permissions 
    for to work",
                                            preferredStyle: .alert)
    let settingsAction = UIAlertAction (title: "Settings", style: 
    .default, handler: ({ (_) -> Void in

        guard let settingsUrl = URL(string: 
 UIApplication.openSettingsURLString) else {
            return}
        if(UIApplication.shared.canOpenURL(settingsUrl)){
            UIApplication.shared.open(settingsUrl, options: [:], completionHandler: { (success) in })

        }
    }))
    let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, 
  handler: nil)

    alertController.addAction(settingsAction)
    alertController.addAction(cancelAction)
    self.present(alertController, animated: true, completion: nil)
}

}

我的 swift 版本是 4.2 ,构建目标版本是 12.1 。请让我知道我是什么

尝试

gsmMapView = GMSMapView.map(withFrame: mapView.bounds, camera: camera)
mapView.addSubview(gsmMapView)