使用 objective-c 限制 Google 特定国家/地区的自动完成地点搜索 API
Limit Google Autocomplete Place Search API for specific country using objective-c
我正在尝试使用 objective-c 限制特定国家(例如孟加拉国)的 Google 自动完成地点搜索 API。这是我的代码
APICommunicator *api = [[APICommunicator alloc] init];
_searchTermArray=[[NSMutableArray alloc]init];
NSDictionary *arr = [api getGoogleAPIArrByPOST:[NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/place/autocomplete/json?input=%@®ion=BD@&types=geocode&key=%@",searchTerms,API_KEY] parameter:nil];
NSString *areaName;
for (areaName in arr) {
_searchTermArray=[[arr valueForKey:@"predictions"]valueForKey:@"description"];
}
// _searchTermArray=[[NSMutableArray alloc]initWithArray:arr];
NSLog(@"%@",[_searchTermArray description]);
但无法按国家限制。如果有人帮助我解决问题,我将不胜感激。谢谢
我正在尝试使用 objective-c 限制特定国家(例如孟加拉国)的 Google 自动完成地点搜索 API。这是我的代码
APICommunicator *api = [[APICommunicator alloc] init];
_searchTermArray=[[NSMutableArray alloc]init];
NSDictionary *arr = [api getGoogleAPIArrByPOST:[NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/place/autocomplete/json?input=%@®ion=BD@&types=geocode&key=%@",searchTerms,API_KEY] parameter:nil];
NSString *areaName;
for (areaName in arr) {
_searchTermArray=[[arr valueForKey:@"predictions"]valueForKey:@"description"];
}
// _searchTermArray=[[NSMutableArray alloc]initWithArray:arr];
NSLog(@"%@",[_searchTermArray description]);
但无法按国家限制。如果有人帮助我解决问题,我将不胜感激。谢谢