Objective c 在目标C中限制特定城市的完整搜索api
我已经限制了一个特定国家(比如孟加拉国)的完整搜索api。现在我想对孟加拉国的达卡市进行限制。下面提供了我的代码Objective c 在目标C中限制特定城市的完整搜索api,objective-c,api,google-maps,google-places-api,Objective C,Api,Google Maps,Google Places Api,我已经限制了一个特定国家(比如孟加拉国)的完整搜索api。现在我想对孟加拉国的达卡市进行限制。下面提供了我的代码 APICommunicator *api = [[APICommunicator alloc] init]; _searchTermArray=[[NSMutableArray alloc]init]; NSDictionary *arr = [api getGoogleAPIArrByPOST:[NSString string
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&components=country:BD&types=geocode&key=%@",searchTerms,API_KEY]parameter:nil];
NSString *areaName;
for (areaName in arr) {
_searchTermArray=[[arr valueForKey:@"predictions"]valueForKey:@"description"];
}
请告诉我如何对城市进行限制的方法或代码。在此,您可以通过传递城市
类型参数,将地点自动完成请求的结果限制为特定类型
cities
类型集合指示Places服务返回与locality
或administration\u area\u level\u 3
匹配的结果
例如:
对包含“Vict”且结果为巴西葡萄牙语的城市的请求:
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Vict&types=(cities)&language=pt_BR&key=YOUR_API_KEY
希望这有帮助