1

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

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

//
//  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 的兼容性,并且该字段对于应用程序的业务逻辑非常重要,我该怎么办?

谢谢!

4

1 回答 1

1

确保同时导入GooglePlacesGoogleMapsBase

GMSCoordinateBounds 在 GoogleMapBase 中定义。

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

GooglePlaces/GooglePlaces.h 不再包含来自 GoogleMapsBase.h 的类,因此如果您在代码中使用 GMSCoordinateBounds 类,您现在也必须 #import GoogleMapsBase/GoogleMapsBase.h。

于 2020-03-15T09:40:36.417 回答