簡體   English   中英

'GMPlace' 類型的值在 GooglePlaces Cocoapod 3.3.7 中沒有成員 'viewport'

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

幾年后,這個問題中描述的問題再次出現,

在最新版本的 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的兼容性,並且該字段對於應用程序的業務邏輯非常重要,我該怎么辦?

謝謝!

確保您同時導入GooglePlacesGoogleMapsBase

GMSCoordinateBounds 在 GoogleMapBase 中定義。

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

GooglePlaces/GooglePlaces.h 不再傳遞包含來自 GoogleMapsBase.h 的類,因此如果您在代碼中使用 GMSCoordinateBounds 類,您現在還必須 #import GoogleMapsBase/GoogleMapsBase.h。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM