2013-04-22 27 views
5

Tôi xử lý tweet hủy và hoàn thành điều kiện trong khối hoàn thành nó đang hoạt động và khi tôi gửi tweet trùng lặp nó hiển thị thông báo lỗi tweet trùng lặp ok tốt nhưng vấn đề của tôi là sau khi lỗi trùng lặp nó cho thấy tweet được hoàn thành tin nhắn vì vậy tôi muốn ngừng tweet hoàn thành tin nhắn trong trường hợp thông báo lỗi trùng lặp, vui lòng giải quyết vấn đề của tôi. đây là mã làm việc của tôi.Làm thế nào để xử lý lỗi tweet trùng lặp trong ios 6

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

Bạn đã tìm thấy giải pháp cho vấn đề này –

Trả lời

0

Bạn không thể thêm giá trị boolean? repeated = FALSE và chuyển sang TRUE khi thông báo đầu tiên xuất hiện. Sau đó, trong khối xử lý hoàn thành của bạn chỉ cần xác minh

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

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

     msg = @"Tweet composition completed."; 

} 
Các vấn đề liên quan