How to handle duplicate tweet error in ios 6

I processed the cancellation of a tweet and completed the condition in my completion block, it works, and when I send a duplicate tweet, it shows a duplicate tweet error message, ok, but my problem only after duplicating the error shows that the tweet message is complete, so I want stop tweet completed message in case of duplicate error message, please solve my problem. here is my working code.

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
       };
}
+5
source share
1 answer

Can you add a boolean? repeated = FALSEand switch it to TRUEwhen the first message appears. Then in the completion handler block just check

    else if (result == TWTweetComposeViewControllerResultDone && repeated != TRUE) {            

        NSLog(@"result %d",result);

        msg = @"Tweet composition completed.";

} 
0
source

All Articles