加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-14 19:42:03 所属栏目:百科 来源:网络整理
导读:我正在尝试在我的应用程序中的视图中设置地图,我遇到了这个问题: 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’中加载优化模型
CoreData:注释:无法在路径’/var/containers/Bundle/Application/35C61A40-48B9-40E0-A6F9-AB7492A15009/simply-convertor.app/GoogleMaps.bundle/GMSCacheStorage.momd/Storage.omo’中加载优化模型

我向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
    }

问题是什么?

解决方法

我发现我的问题..似乎我误解了GMSMapView的初始化并且没有正确初始化它.

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读