Reputation: 787
I am trying to limit Google Autocomplete Place Search API for specific country for example Bangladesh using objective-c. Here is my code
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]);
But unable to limit it by country. I will be grateful if anyone help me with a solution. Thanks.
Upvotes: 0
Views: 534
Reputation: 1077
try to use this url for getting result in specific country https://maps.googleapis.com/maps/api/place/autocomplete/json?input=xyz®ion=BD&components=country:BD&types=geocode&key=yourapi_key
Upvotes: 1