【发布时间】:2017-02-09 02:31:28
【问题描述】:
我正在使用官方Google Documentation 来创建地址查找。
在 Android 版本中,我可以将结果偏向我所在的区域。
例如,输入“123 Main St”会先显示我所在城镇的 Main st,然后再显示其他结果。
在 iOS 中,我不知道该怎么做。我正在使用带有GMSAutocompleteViewController 委托的“添加全屏控件”。
有一个GMSCoordinateBounds,但该示例是针对地图的。我没有使用地图。
我已经修改过类似的东西,但无法让它工作。我什至走在正确的轨道上吗?
- (void) placeAutocomplete : (NSString*) location : Bounds:(GMSCoordinateBounds *)bounds{
[_placesClient autocompleteQuery:location
bounds:bounds
filter:filter
callback:^(NSArray *results, NSError *error) {
if (error != nil) {
NSLog(@"Autocomplete error %@", [error localizedDescription]);
return;
}
for (GMSAutocompletePrediction* result in results) {
NSLog(@"Result '%@' with placeID %@", result.attributedFullText.string, result.placeID);
}
}];
}
有什么帮助吗?
【问题讨论】:
标签: ios objective-c google-places-api gmsautocomplete