在我的iOS应用程序中,我有Google Maps SDK,我正在使用GMSPlacePicker在特定坐标周围选择一个位置,如下所示:
//center is a CLLocationCoordinate2D
CLLocationCoordinate2D northEast = CLLocationCoordinate2DMake(center.latitude + 0.001,center.longitude + 0.001);
CLLocationCoordinate2D southWest = CLLocationCoordinate2DMake(center.latitude - 0.001,center.longitude - 0.001);
GMSCoordinateBounds *viewport = [[GMSCoordinateBounds alloc] initWithCoordinate:northEast coordinate:southWest];
GMSPlacePickerConfig *config = [[GMSPlacePickerConfig alloc] initWithViewport:viewport];
_placePicker = [[GMSPlacePicker alloc] initWithConfig:config];
[_placePicker pickPlaceWithCallback:^(GMSPlace *place, NSError *error) {
if (error != nil) {
NSLog(@"Pick Place error %@", [error localizedDescription]);
}
else if (place) {
CLLocationCoordinate2D c = place.coordinate;
//place.coordinate doesn't exist
}
}];然而,尽管谷歌表示有here,但没有place.coordinate属性,有什么想法为什么没有吗?
发布于 2015-09-12 00:40:03
我在Swift工作,但这可能会有帮助。GMSPlace的‘comes’属性是可选的,因此它可能不需要有一个值。你能检查它的存在吗?
作为一种变通方法,我使用基于'googlePlaceID‘的'lookupPlaceID’调用来查找坐标,但它需要额外的API调用。
https://stackoverflow.com/questions/32423284
复制相似问题