2017-10-08 95 views
6

我试图设置一个映射在我的应用程序的视图和我这个问题:问题谷歌地图API和Xcode 9

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 /容器/包/应用/ 35C61A40-48B9-40E0-A6F9-AB7492A15009/simply-convertor.app/GoogleMaps.bundle/GMSCacheStorage.momd /存储。 omo'

我向我的ViewContoroller添加一个空视图,并将其类型更改为GMSMapView。 而在viewDidLoad方法我创建位置的新地图和init我的主要的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 
    } 

是什么问题?

+0

错误消息表明您已经遗漏了某些Google地图框架需要的文件。谷歌地图有一个内部错误,因为它找不到它预期存在的文件。 –

+0

我该如何解决它?我通过CococaPods安装它 –

+0

我不能说,这就是为什么我留下评论而不是回答。错误信息强烈表明它不是核心数据问题,但是核心数据有问题,因为缺少关键文件。 –

回答

2

我发现我的问题..看来我误会了GMSMapView中的initialliztion,而不是将其初始化正确..

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

+1

我有同样的警告。你能分享你的解决方案吗? – Edward

+1

我也有同样的问题。你能分享你的解决方案吗?谢谢 – LuongTruong

+1

我有同样的警告。你能分享你的解决方案吗? –