使用Xcode 9在iOS 11上发布Google maps API

时间:2023-01-17 22:24:01

I'm trying to set a map in a view in my app and I got this problem:

我正在尝试在我的应用程序中的视图中设置地图,我遇到了这个问题:

CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/Application/35C61A40-48B9-40E0-A6F9-AB7492A15009/simply-convertor.app/GoogleMaps.bundle/GMSCacheStorage.momd/Storage.omo' CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/Application/35C61A40-48B9-40E0-A6F9-AB7492A15009/simply-convertor.app/GoogleMaps.bundle/GMSCacheStorage.momd/Storage.omo' CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/Application/35C61A40-48B9-40E0-A6F9-AB7492A15009/simply-convertor.app/GoogleMaps.bundle/GMSCacheStorage.momd/Storage.omo'

CoreData:注释:无法在路径'/var/containers/Bundle/Application/35C61A40-48B9-40E0-A6F9-AB7492A15009/simply-convertor.app/GoogleMaps.bundle/GMSCacheStorage.momd/Storage.omo'CoreData上加载优化模型:注释:无法在路径'/var/containers/Bundle/Application/35C61A40-48B9-40E0-A6F9-AB7492A15009/simply-convertor.app/GoogleMaps.bundle/GMSCacheStorage.momd/Storage.omo'中加载优化模型'CoreData:注释:无法在路径'/var/containers/Bundle/Application/35C61A40-48B9-40E0-A6F9-AB7492A15009/simply-convertor.app/GoogleMaps.bundle/GMSCacheStorage.momd/Storage.omo'中加载优化模型

I add an empty view to my ViewContoroller and change it's type to GMSMapView. And in viewDidLoad method I create a new map from location and init my main mapView:

我向ViewContoroller添加一个空视图,并将其类型更改为GMSMapView。在viewDidLoad方法中,我从location创建一个新的map并初始化我的主mapView:

override func viewDidLoad() {
        super.viewDidLoad()
        placesClient = GMSPlacesClient.shared()
        locationManager.delegate = self
        locationManager.desiredAccuracy = kCLLocationAccuracyBest
        locationManager.requestWhenInUseAuthorization()
        locationManager.startMonitoringSignificantLocationChanges()

        locationAuthStatus()
        print(location.coordinate.latitude, location.coordinate.longitude)
        let camera = GMSCameraPosition.camera(withLatitude: 31.9650070083707, longitude: 34.7899029677496, zoom: 6.0)
        let map = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
        self.mapView = map

        // Creates a marker in the center of the map.
        let marker = GMSMarker()
        marker.position = CLLocationCoordinate2D(latitude: 31.9650070083707, longitude: 34.7899029677496)
        marker.title = "Home"
        marker.snippet = "Home"
        marker.map = mapView
    }

what is the problem?

问题是什么?

1 个解决方案

#1


2  

I find my problem.. it appears I misunderstood the initialliztion of a GMSMapView and not initialize it correct..

我发现了我的问题..看来我误解了GMSMapView的初始化并没有初始化它是正确的..

From other post the CoreData error that I mention is a problem of Google's API and it doesn't affect the app.

从其他帖子我提到的CoreData错误是Google的API问题,它不会影响应用程序。

#1


2  

I find my problem.. it appears I misunderstood the initialliztion of a GMSMapView and not initialize it correct..

我发现了我的问题..看来我误解了GMSMapView的初始化并没有初始化它是正确的..

From other post the CoreData error that I mention is a problem of Google's API and it doesn't affect the app.

从其他帖子我提到的CoreData错误是Google的API问题,它不会影响应用程序。