(iOS Swift)谷歌地图动画视频更新不起作用

(iOS Swift)谷歌地图动画视频更新不起作用,ios,swift,google-maps,Ios,Swift,Google Maps,我在iOS中使用谷歌地图。我想给我的相机设置动画,这样它就能显示所有需要的纬度和高度。我将这些位置存储在数组中(作为CLLocationCoordinate2D实例),并使用GMSCoordinateBounds类添加这些位置。这是我的代码: let bounds = GMSCoordinateBounds() bounds.includingCoordinate(firstLocation) bounds.includingCoordinate(

我在iOS中使用谷歌地图。我想给我的相机设置动画,这样它就能显示所有需要的纬度和高度。我将这些位置存储在数组中(作为CLLocationCoordinate2D实例),并使用GMSCoordinateBounds类添加这些位置。这是我的代码:

        let bounds = GMSCoordinateBounds()
        bounds.includingCoordinate(firstLocation)
        bounds.includingCoordinate(lastLocation)
        let camUpdate = GMSCameraUpdate.fit(bounds, withPadding: 60)

        mMapView.camera = GMSCameraPosition.camera(withLatitude: firstLocation.latitude, longitude: firstLocation.longitude, zoom: 18)

        mMapView.animate(with: camUpdate)

firstLocation和lastLocation的值正确,但相机未设置动画。我错过什么了吗

非常愚蠢的错误。includingCoordinates函数返回GMSCoordinateBounds对象。我必须重新振作起来,它才能像这样工作:

bounds = bounds.includingCoordinate(firstLocation)

bounds = bounds.includingCoordinate(lastLocation)

如果我像上面那样设置,它工作得很好。

非常感谢,您为我节省了很多时间,我也遇到了同样的问题:)