IB Designables: Failed to render and update auto layout status for Google Maps

做~自己de王妃 提交于 2020-01-21 06:31:09

问题


I'm using GoogleMaps Pod in my project. I have error in one of my Storyboard:

error: IB Designables: Failed to render and update auto layout status for MapViewController: dlopen(GoogleMaps.framework, 1): no suitable image found. Did find: GoogleMaps.framework: mach-o, but wrong filetype

I have set view class to GMSMapView:

App is working on simulator. How I can fix this error? It causes whole storyboard to be blank.


回答1:


Use GMSMapView manually by writing code in simulator; Instead of using GMSMapView in storyboard.

If you are using maps in multiple screen. then write code manually for all file.

@IBOutlet weak var map_Views: UIView!
var map_View = GMSMapView()
override func viewDidLoad() {

    super.viewDidLoad()

    let camera = GMSCameraPosition.camera(withLatitude: Double(main_latitude)!, longitude: Double(main_longitude)!, zoom: 6.0)
     map_View = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
    map_Views = map_View

    map_View.camera = GMSCameraPosition.camera(withLatitude:Double(main_latitude)!,
                                                    longitude:Double(main_longitude)!,
                                                    zoom:10.0,
                                                    bearing: 0,
                                                    viewingAngle: 0)

}



回答2:


Create Subclass of GMSMapView and use that class name instead of GMSMapView. after adding this error will not occur and whole storyboard is working.

import GoogleMaps

class GoogleMapView : GMSMapView {

}


来源:https://stackoverflow.com/questions/48263094/ib-designables-failed-to-render-and-update-auto-layout-status-for-google-maps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!