Closed Newsid closed 8 years ago
it is working fyn.but it is not giving my tweets whatever i posted in my twitter application and what others posted in my time line.this is my code
(void)listResults { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ @autoreleasepool { [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
// the following line contains a FHSTwitterEngine method wich do the search.
NSDictionary *dict = [[FHSTwitterEngine sharedEngine]searchTweetsWithQuery: @"q"];
// NSLog(@"%@",dict);
NSArray *results = [dict objectForKey:@"statuses"];
// NSLog(@"array text = %@",results);
for (NSDictionary *item in results) {
NSLog(@"text == %@",[item objectForKey:@"text"]);
NSLog(@"name == %@",[[item objectForKey:@"user"]objectForKey:@"name"]);
NSLog(@"screen name == %@",[[item objectForKey:@"user"]objectForKey:@"screen_name"]);
NSLog(@"pic == %@",[[item objectForKey:@"user"]objectForKey:@"profile_image_url_https"]);
}
dispatch_sync(dispatch_get_main_queue(), ^{
@autoreleasepool {
UIAlertView *av = [[UIAlertView alloc]initWithTitle:@"Complete!" message:@"Your list of followers has been fetched" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[av show];
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}
});
}
}); }
Hello, I was trying to search tweets with a particular hashtag
using the method
i had no result
I tried to simplify this method using only the parameter "q" and it works fine! It returns me all recent tweets with the hashtag in the parameter "q"
the simple method is:
(id)searchTweetsWithQuery:(NSString *)q {
if (q.length == 0) { return [NSError badRequestError]; }
if (q.length > 1000) { q = [q substringToIndex:1000]; }
NSURL *baseURL = [NSURL URLWithString:url_search_tweets];
NSMutableDictionary *params = [[NSMutableDictionary alloc] init]; [params setObject:q forKey:@"q"]; return [self sendGETRequestForURL:baseURL andParams:params]; }
I hope it helps you.
CP