I have an app that shows tweets on a map and when one is selected it shows more details for the tweet (twitter handle, the tweet, profile pic, etc.) There are buttons for favoriting and retweeting the tweet. 该应用程序使用 STTwitter 与 Twitter API 交互,并使用twitter = [STTwitterAPI twitterAPIOSWithFirstAccount];
推文详细视图中的转发和收藏来验证应用程序的用户,我这样做:
- (IBAction)retweet:(id)sender {
[twitter postStatusRetweetWithID:tweetID successBlock:^(NSDictionary *status) {
UIAlertView *retweetSuccess = [[UIAlertView alloc]initWithTitle:@"Retweeted!" message:@"You have retweeted this post." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[retweetSuccess show];
} errorBlock:^(NSError *error) {
UIAlertView *retweetFailure = [[UIAlertView alloc]initWithTitle:@"Retweet Failed!" message:@"" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[retweetFailure show];
}];
}
- (IBAction)favorite:(id)sender {
[twitter postFavoriteCreateWithStatusID:tweetID includeEntities:nil successBlock:^(NSDictionary *status) {
UIAlertView *favoriteSuccess = [[UIAlertView alloc]initWithTitle:@"Favorited!" message:@"You have favorited this post." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[favoriteSuccess show];
} errorBlock:^(NSError *error) {
UIAlertView *favoriteFailure = [[UIAlertView alloc]initWithTitle:@"Favorite Failed!" message:@"" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[favoriteFailure show];
}];
}
如何检测一条推文是否已被用户转发或收藏,以便我可以为转发和收藏按钮显示不同的按钮图像?