'GMSPlace' 类型的值在 GooglePlaces Cocoapod 3.3.7 中没有成员 'viewport'

Value of type 'GMSPlace' has no member 'viewport' in GooglePlaces Cocoapod 3.3.7

几年后question中描述的问题再次出现,

在最新版本的 GooglePlaces cocoapod (3.3.7) 中,viewport 字段不可访问,尽管该字段存在于 class 界面中

//
//  GMSPlace.h
//  Google Places SDK for iOS
//
//  Copyright 2016 Google Inc.
//
//  Usage of this SDK is subject to the Google Maps/Google Earth APIs Terms of
//  Service: https://developers.google.com/maps/terms
//

.....
other fields
.....

/**
* The recommended viewport for this place. May be nil if the size of the place is not known.
*
* This returns a viewport of a size that is suitable for displaying this place. For example,    a
* |GMSPlace| object representing a store may have a relatively small viewport, while a |GMSPlace|
* object representing a country may have a very large viewport.
*/
@property(nonatomic, strong, readonly, nullable) GMSCoordinateBounds *viewport;

.....
.....

需要更新以确保与 API 的兼容性,并且该字段对于应用程序的业务逻辑非常重要,我该怎么办?

谢谢!

确保同时导入 GooglePlacesGoogleMapsBase.

GMSCoordinateBounds 在 GoogleMapBase 中定义。

Google 在版本 3.5.0 更新日志中提到了这个变化:https://developers.google.com/places/ios-sdk/releases

GooglePlaces/GooglePlaces.h no longer transitively includes classes from GoogleMapsBase.h, so if you use the GMSCoordinateBounds class in your code, you must now #import GoogleMapsBase/GoogleMapsBase.h as well.