【问题标题】:IB Designables: Failed to render and update auto layout status for Google MapsIB Designables:无法为 Google 地图呈现和更新自动布局状态
【发布时间】:2018-06-24 02:09:47
【问题描述】:

我在我的项目中使用 GoogleMaps Pod。我的故事板之一有错误:

错误:IB Designables:无法渲染和更新 MapViewController 的自动布局状态:dlopen(GoogleMaps.framework, 1):找不到合适的图像。发现: GoogleMaps.framework:mach-o,但文件类型错误

我已将视图类设置为 GMSMapView:

应用正在模拟器上运行。我该如何解决这个错误?它会导致整个情节提要为空白。

【问题讨论】:

  • storyboard:错误:IB Designables:无法渲染和更新 NearByPlaceListingViewController (yxD-BC-CKt) 的自动布局状态:dlopen(GoogleMaps.framework, 1):找不到合适的图像。确实找到了:GoogleMaps.framework: mach-o, but wrong filetype I am getting Same Error... in Xcode 9.2
  • 修复后请提出建议。
  • 我现在正在创建这个地图视图表单代码,我无法从情节提要中使它工作。 @ShahabuddinVansiwala

标签: ios uiview uistoryboard google-maps-sdk-ios


【解决方案1】:

创建 GMSMapView 的子类并使用该类名代替 GMSMapView。添加此错误后不会发生,整个情节提要正在工作。

import GoogleMaps

class GoogleMapView : GMSMapView {

}

【讨论】:

  • 在我的情况下没有解决问题。我什至将 GMSMapView 更改为简单的 UIView,尽管清理、删除派生数据并重新启动 Xcode,但我仍然遇到故事板问题。
【解决方案2】:

通过在模拟器中编写代码手动使用 GMSMapView;而不是在故事板中使用GMSMapView

如果您在多个屏幕中使用地图。然后为所有文件手动编写代码。

@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)

}

【讨论】:

  • 我是这样做的,并在此处发布,我的回答有 3 票反对。 ://
  • @Prettygeek 请分享您的答案链接
  • 我在 4 个月前删除了它。
猜你喜欢
  • 2018-03-25
  • 1970-01-01
  • 1970-01-01
  • 2020-06-29
  • 2017-02-05
  • 1970-01-01
  • 2018-12-01
相关资源
最近更新 更多