Implementing search function in IOS using api1.1


#1

I followed the example given here: https://dev.twitter.com/docs/ios/making-api-requests-slrequest.

This example only shows how to get the timeline of the user. Instead I wanna use the search api such that given the longitude and lantitude pair plus a range, it could return tweets within that area.

However, I’m not quite clear about the param variable used in that example. I tried the search api with the param variable, an error occurs. I guess there must be something wrong with param. Could anyone please give me a hint on it?

NSDictionary *params = @{@“screen_name” : @“user_name”,
@“include_rts” : @“0”,
@“trim_user” : @“1”,
@“count” : @“5”};


#2

Yes, your params will not work for that endpoint. According to [node:10287], you need at least the parameter q to make a query to the search endpoint. So, to perform a search for my screen name, @theSeanCook, you could use the following URL and params:

NSURL *url = [NSURL URLWithString:@"https://api.twitter.com/1.1/search/tweets.json"]; NSDictionary *params = @{@"q" : @"theSeanCook", @"count" : @"1"};