Trouble getting search results using MGTwitterEngine
I'm using a version of Matt Gemmell's MGTwitterEngine, and I'm trying to get some results from the getSearchResultsForQuery method.
// do a search
[_engine getSearchResultsForQuery:@"#quote"];
// delegate method for handling result
- (void)searchResultsReceived:(NSArray *)searchResults forRequest:(NSString *)connectionIdentifier
{
if ([searchResults count] >开发者_运维知识库; 0)
{
NSDictionary *singleResult = [searchResults objectAtIndex:1];
NSString *text = [singleResult valueForKey:@"text"];
NSLog(@"Text at Index one: \n %@", text);
}
}
However, I never appear to get the result. In the console, I get:
Request 7E4C3097-88D6-45F1-90D2-AD8205FBAAC5 failed with error: Error Domain=HTTP Code=400 "Operation could not be completed. (HTTP error 400.)"
Is there a way around this? Am I implementing the delegate method right? (Also, I had difficulty installing the YAJL stuff for the engine, and wonder if that has something to do with it)
Build MGTwitterEngine with DEBUG constant equal to 1, take a look at what finalURL gives you. Post it here or confirm that it is correct with http://apiwiki.twitter.com/Twitter-API-Documentation
I get this:
(gdb) po error->_userInfo
{
body = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<hash>\n
<request>/oauth /access_token\n
<error>Client application is not permitted to use xAuth.</error>\n</hash>\n";
response = <NSHTTPURLResponse: 0x1c88b0>;
}
You need to request xauth for your application.
精彩评论