swift - 使用 Xcode 9 在 iOS 11 上发布 Google map API

标签 swift xcode google-maps core-data cocoapods

我试图在我的应用程序的 View 中设置 map ,但我遇到了这个问题:

CoreData:注释:无法在路径 '/var/containers/Bundle/Application/35C61A40-48B9-40E0-A6F9-AB7492A15009/simply-convertor.app/GoogleMaps.bundle/GMSCacheStorage.momd/Storage 加载优化模型。奥莫 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 添加了一个空 View ,并将其类型更改为 GMSMapView。 在 viewDidLoad 方法中,我从位置创建了一个新 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 的问题,它不会影响应用程序。

关于swift - 使用 Xcode 9 在 iOS 11 上发布 Google map API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46634225/

相关文章:

iOS UITabBar 使 'fake' 成为事件选项卡?

ios - sonar-swift 分析 xcode 项目

objective-c - XCode 5 单元测试 : starts my app

xcode - Expo 未加载 (React-Native) -- 空 Expo SDK 版本

javascript - 使用 JQuery 在 Google Maps API (V3) 上禁用 infoWindow/Box 内的链接?

java - 在我的应用程序中检索地理位置远不如 Google map 应用程序在我的设备上同时显示的准确

ios - 可选类型 'UIImage?' 的值未展开

ios - 一次从所有 Collection View 单元格内的 TextView 中获取文本

xcode - 如何使用 Xcode Bot 环境变量?

angularjs - Angular 谷歌地图 (AGM) 自动完成