【问题标题】:autocomplete search bar using google API?使用谷歌 API 自动完成搜索栏?
【发布时间】:2013-12-16 12:42:01
【问题描述】:

我是 ios 的新手,我想使用 google API 制作自动完成搜索栏...请告诉我如何制作...仅使用 google API 自动完成搜索栏..

我使用了以下网址,但是如何使用搜索栏完成...

- (NSString *)description
{
return [NSString stringWithFormat:@"Query URL: %@", [self googleURLString]];
}


- (NSString *)googleURLString
{
   NSMutableString *url = [NSMutableString stringWithFormat:@"https://maps.googleapis.com/maps/api/place/autocomplete/json?input=%@&sensor=%@&key=%@",
                        [self.input stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding],
                        SPBooleanStringForBool(self.sensor), self.key];

if (self.offset != NSNotFound) {
    [url appendFormat:@"&offset=%u", self.offset];
}
if (self.location.latitude != -1) {
    [url appendFormat:@"&location=%f,%f", self.location.latitude, self.location.longitude];
    NSLog(@"%@",url);
}
if (self.radius != NSNotFound) {
    [url appendFormat:@"&radius=%f", self.radius];
}
if (self.language) {
    [url appendFormat:@"&language=%@", self.language];
}

return url;
}

【问题讨论】:

  • 请任何人给我这个问题的答案....

标签: iphone autocomplete ios7 google-api xcode5


【解决方案1】:

查看https://github.com/spoletto/SPGooglePlacesAutocomplete

它是 Google Places Autocomplete API 的 Objective-c 包装器。

祝你好运!

【讨论】:

  • 谢谢...但我使用它...但它不搜索详细信息的地方...给我一个错误 domainError 8...当我尝试搜索详细查询时... ..
  • 我认为您使用了此代码,因此您对我的问题有更好的解决方案..请告诉我..
  • 我也遇到了问题,“didFailWithError: Error Domain=kCLErrorDomain Code=0 “操作无法完成。(kCLErrorDomain error 0.)” ....
  • 你有什么解决办法????或者你会从其他人那里得到解决方案,请回答我上面的问题......谢谢......
  • 我在谷歌上找到但没有得到正确的答案。如果你会得到然后回答我...
猜你喜欢
  • 2011-09-19
  • 1970-01-01
  • 2012-01-04
  • 2012-05-05
  • 2019-08-06
  • 1970-01-01
  • 1970-01-01
  • 2017-01-25
  • 2018-07-04
相关资源
最近更新 更多