当我创建一个新的GMSMapView时,它不会加载。在我的项目中,我有其他的GMSMapViews可以正确地加载。我使用故事板编辑器将GMSMapView的自定义子类分配给UIView。为什么新的不能用?
发布于 2017-02-20 20:09:56
通过查看我的故事板文件的源代码,我找到了这个问题的解决方案。
我以前的GMSMapViews是这样的:
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO"
id="hbm-BT-3Ow" customClass="GMSMapView">我的新照片是这样的:
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO"
id="alb-9Z-Vu8" customClass="GMSMapView"
customModule="{My Project Name}" customModuleProvider="target">当我为一个新的GMSMapView将自定义类设置为UIView时,关联的模块是“我的项目”,而不是以前的“无”。

问题是我在我的项目中为GMSMapView创建了一个自定义扩展。
extension GMSMapView {
var visibleBounds: GMSCoordinateBounds {
return GMSCoordinateBounds(region: self.projection.visibleRegion())
}
}解决方案:
将extension GMSMapView改为extension GoogleMaps.GMSMapView解决了我的问题。
https://stackoverflow.com/questions/42353392
复制相似问题