在 google 中搜索名称在 ios 中的地图 sdk
Searching locations with name in google maps sdk in ios
我在我的项目中使用 Google 地图 sdk。我在顶部有搜索栏,我必须搜索用户在该搜索栏中输入的位置。其次搜索栏应该给出提示,比如如果我们在 Google 地图中搜索位置 application.Any 帮助将不胜感激。
先决条件
Get Started with GOOGLE PLACE API on iOS
步骤
- 您需要使用在文本字段中输入的文本创建一个 url。
附加文本字段中的文本创建一个 url 像这样
NSURL *URL = [NSURL URLWithString:[NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/place/textsearch/json?query=%@&key=%s",queryText,kGooglePlaceAPI键]];
其中 queryText 是 text,而 kGooglePlaceAPIKey 是你的 GOOGLE PLACES API KEY.
对此 URL 进行 JSON 解析。
您将获得与文本字段中输入的文本相关的所有位置信息。
图:JSON 使用 JSONViewer Addon
在 Firefox 浏览器上的响应
有关更多信息,请参阅此站点:Google Places Text Search Requests
希望对您有所帮助
干杯
:)
我在我的项目中使用 Google 地图 sdk。我在顶部有搜索栏,我必须搜索用户在该搜索栏中输入的位置。其次搜索栏应该给出提示,比如如果我们在 Google 地图中搜索位置 application.Any 帮助将不胜感激。
先决条件
Get Started with GOOGLE PLACE API on iOS
步骤
- 您需要使用在文本字段中输入的文本创建一个 url。
附加文本字段中的文本创建一个 url 像这样
NSURL *URL = [NSURL URLWithString:[NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/place/textsearch/json?query=%@&key=%s",queryText,kGooglePlaceAPI键]];
其中 queryText 是 text,而 kGooglePlaceAPIKey 是你的 GOOGLE PLACES API KEY.
对此 URL 进行 JSON 解析。
您将获得与文本字段中输入的文本相关的所有位置信息。
图:JSON 使用 JSONViewer Addon
在 Firefox 浏览器上的响应有关更多信息,请参阅此站点:Google Places Text Search Requests
希望对您有所帮助 干杯 :)