ios - Is it possible using Foursquare API search places containing string? -


i want search result google search.enter image description here

here if search 'tokyo' gives me 4 results containing place 'tokyo'. same functionality want using foursquare api. able find near places current position or given position.

you need use https://api.foursquare.com/v2/venues/search endpoint , use query parameter return matches based on keyword. since you're on ios can use uitableview show results search suggestions or other libraries fit requirement. since autocomplete/autosuggest search, suggest try call endpoint on change event of text field delay.

example using afnetworking library ios:

afhttprequestoperationmanager *manager = [afhttprequestoperationmanager manager];  nsmutabledictionary *params = [[nsmutabledictionary alloc] init]; [params setobject:foursquare_clientid forkey:@"client_id"]; [params setobject:foursquare_clientsecret forkey:@"client_secret"]; [params setobject:searchtextfield.text forkey:@"query"]; [params setobject:latlong forkey:@"ll"]; [params setobject:foursquare_version forkey:@"v"];  [manager get:@"https://api.foursquare.com/v2/venues/search" parameters:nil success:^(afhttprequestoperation *operation, id responseobject) {     nslog(@"json: %@", responseobject);     //process json response here , output each venue name search suggestion } failure:^(afhttprequestoperation *operation, nserror *error) {     nslog(@"error: %@", error); }]; 

i suggest read more on foursquare documentation , how process json results , show them uitableview if don't know how yet.

also notice still have provide "ll" parameter since can query nearby places using endpoint.

for global search , not using "ll" or "nearby" parameter. can try use global intent according documentation:

finds globally relevant venues search, independent of location. ignores other parameters other query , limit.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -