Using the Twitter Search API I have attempted to download JSON data from a specific twitter user. If I use the recommended schema for a from:username twitter recommends http://search.twitter.com/search.json?q=%3Ausername
For example if I want to query tweets FROM @NBCNews, twitter recommends the following:
http://search.twitter.com/search.json?q=%3ANBCNews
In my code I make an NSURLRequest for this JSON data but the NSString that is instantiated somehow has an odd string of numbers and letters where the “%3A” portion of the URL was.
I have made 2 similar strings to test, *path and *workingPath. *path is a call to return all tweets from the user:NBCNews and *workingPath is a call to return all tweets containing NBCNews.
- (void)loadQuery {
NSString *path = [NSString stringWithFormat:@"http://search.twitter.com/search.json?rpp=%d&q=%3ANBCnews",
RESULTS_PERPAGE];
NSString *workingPath = [NSString stringWithFormat:@"http://search.twitter.com/search.json?rpp=%d&q=NBCnews",
RESULTS_PERPAGE,self];
path = [path stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSLog(@"path --> %@", path);
NSLog(@"path --> %@", workingPath);
I have included the output in the debug console where you can see the difference.
Pending breakpoint 1 - ""TwitterSearchViewController.m":334" resolved
2012-01-06 22:01:11.785 emsguide[7286:11603] path --> http://search.twitter.com/search.json?rpp=100&q=0X1.A000040DA604P-1025NBCnews
2012-01-06 22:01:11.786 emsguide[7286:11603] workingPath --> http://search.twitter.com/search.json?rpp=100&q=NBCnews
Current language: auto; currently objective-c
Here the string “0X1.A000040DA604P-1025” replaced %3A in my URL.
Anyone seen this or have thoughts?
Despite what the search.twitter.com result renders, the code does not need %3A and the URL scheme works with from:username
changed:
to