2017-10-08 100 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

我有同樣的警告。你能分享你的解決方案嗎? –