GoogleMaps Cocoapod中缺少GMSPlace视口成员 [英] GMSPlace viewport member missing in GoogleMaps cocoapod
问题描述
我正在实现iOS地图视图.我设置了Google Search Api以实施地点搜索.
I'm implementing an iOS Map View. I set up Google Search Api to implement a places search.
我用过这样的可可足类
pod 'Google' , '~> 1.2.1'
pod 'GoogleMaps', '~> 1.11.0'
当用户搜索某些关键字时,我会得到 GMSPlace
的列表.当用户选择 GMSPlace
对象时,我运行此代码以获取坐标.
When the user searches for some keywords I get a list of GMSPlace
. When the user selects on of the GMSPlace
objects, I run this code to get the coordinates.
placesClient?.lookUpPlaceID(placeID, callback: { (place: GMSPlace?, error: NSError?) -> Void in
if let place = place {
print("Place name \(place.name)")
print("Place coordinate \(place.coordinate)")
// how to find the viewport?
} else {
print("No place details for \(placeID)")
}
})
如果您在此处查看 https://developers.google.com/maps/documentation/ios-sdk/reference/interface_g_m_s_place GMSPlace
具有成员 viewport
-此位置的推荐视口.
If you take a look here https://developers.google.com/maps/documentation/ios-sdk/reference/interface_g_m_s_place GMSPlace
has member viewport
- The recommended viewport for this place.
但是,如果我CMD单击Xcode中的GMSPlace,我将进入此类.它没有视口成员.
But if I CMD-Click the GMSPlace in Xcode I come to this class. It does not have the viewport member.
/**
* Represents a particular physical place. A GMSPlace encapsulates information about a physical
* location, including its name, location, and any other information we might have about it. This
* class is immutable.
*/
public class GMSPlace : NSObject {
/** Name of the place. */
public var name: String! { get }
/** Place ID of this place. */
public var placeID: String! { get }
/**
* Location of the place. The location is not necessarily the center of the Place, or any
* particular entry or exit point, but some arbitrarily chosen point within the geographic extent of
* the Place.
*/
public var coordinate: CLLocationCoordinate2D { get }
/**
* Represents the open now status of the place at the time that the place was created.
*/
public var openNowStatus: GMSPlacesOpenNowStatus { get }
/**
* Phone number of this place, in international format, i.e. including the country code prefixed
* with "+". For example, Google Sydney's phone number is "+61 2 9374 4000".
*/
public var phoneNumber: String! { get }
/**
* Address of the place as a simple string.
*/
public var formattedAddress: String! { get }
/**
* Five-star rating for this place based on user reviews.
*
* Ratings range from 1.0 to 5.0. 0.0 means we have no rating for this place (e.g. because not
* enough users have reviewed this place).
*/
public var rating: Float { get }
/**
* Price level for this place, as integers from 0 to 4.
*
* e.g. A value of 4 means this place is "$$$$" (expensive). A value of 0 means free (such as a
* museum with free admission).
*/
public var priceLevel: GMSPlacesPriceLevel { get }
/**
* The types of this place. Types are NSStrings, valid values are any types documented at
* <https://developers.google.com/places/supported_types>.
*/
public var types: [AnyObject]! { get }
/** Website for this place. */
@NSCopying public var website: NSURL! { get }
/**
* The data provider attribution string for this place.
*
* These are provided as a NSAttributedString, which may contain hyperlinks to the website of each
* provider.
*
* In general, these must be shown to the user if data from this GMSPlace is shown, as described in
* the Places API Terms of Service.
*/
@NSCopying public var attributions: NSAttributedString! { get }
}
我需要怎么做才能获得所需的课程?
What do I need to do to get the desired class?
最良好的祝愿.
推荐答案
最新的cocoapod拥有它!我只需要更新.
The newest cocoapod has it! I just had to update.
这篇关于GoogleMaps Cocoapod中缺少GMSPlace视口成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!