我处理推文取消和完成条件在它的完成块它正在工作,当我发送重复的推文它显示重复推文错误消息确定没问题但我的问题是在重复错误后它显示推文已完成消息所以我想停止如果出现重复的错误消息,推文完成消息请解决我的问题。这是我的工作代码。
self.tweetSheet = [[TWTweetComposeViewController alloc] init];
[self.tweetSheet setInitialText:@"Some message."];
[self.navigationController presentModalViewController:self.tweetSheet animated:YES];
// Called when the tweet dialog has been closed
self.tweetSheet.completionHandler = ^(TWTweetComposeViewControllerResult result)
{
NSString * msg;
if (result == TWTweetComposeViewControllerResultCancelled)
{
msg = @"Tweet compostion was canceled.";
}
else if (result == TWTweetComposeViewControllerResultDone)
{
NSLog(@"result %d",result);
msg = @"Tweet composition completed.";
}
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Tweet Status" message:msg delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
// Show alert to see how things went...
[self.tweetSheet dismissModalViewControllerAnimated:YES];
// Dismiss the controller
};
}
答案 0 :(得分:0)
你不能添加一个布尔值吗? repeated = FALSE
,并在第一条消息出现时将其切换为TRUE
。然后在完成处理程序块中验证
else if (result == TWTweetComposeViewControllerResultDone && repeated != TRUE) {
NSLog(@"result %d",result);
msg = @"Tweet composition completed.";
}