2013-04-23 43 views
2

我想彈出MFMessageCompose模型(topviewcontroller)從另一個NSObject類方法,它是在後臺執行。wait_fences:未能收到回覆:10004003錯誤發生時,點擊按鈕(發送,取消)MFmessgecompose模型iOS

我彈出使用此代碼MFMessageCompose模式:

MFMessageComposeViewController * controller = [[MFMessageComposeViewController alloc] init]; 
if([MFMessageComposeViewController canSendText]) 
{ 
    controller.body = @"Check out FundooSpace for mobile.Download it now from app.fundoospace.net/FundooSpace/d"; 
    controller.recipients = (NSArray *)passa; 
    passa = nil; 
    AppDelegate * appDelegateObject1 = (AppDelegate *)[[UIApplication sharedApplication] delegate]; 
    controller.messageComposeDelegate = self; 
    [appDelegateObject1.navigationCntr.topViewController presentModalViewController:controller animated:NO]; 
} 

它工作正常。但是當我點擊發送或取消按鈕,然後應用程序獲取故障並給出錯誤是

wait_fences: failed to receive reply: 10004003 

請建議我。

+0

我想在topviewcontroller上彈出messagecompose模型(它會是任何的) – Mahesh 2013-04-23 11:45:24

回答

0

我完全檢查了你的問題中包含的代碼,對我來說它正在設備上正常運行。

1)確保有委託在你的.h

@interface ViewController : UIViewController <MFMessageComposeViewControllerDelegate> 

2)你還實行委託方法在您的m:

- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result { 
    NSLog(@"didFinishWithResult"); 

    // you have to deal with the result var 

    switch (result) { 
     case MessageComposeResultCancelled: 
      NSLog(@"Cancelled"); 
      break; 
     case MessageComposeResultFailed: 
      UIAlertView *alert = [[UIAlertView alloc] 
          initWithTitle:@"MyApp" 
           message:@"Unknown Error" 
           delegate:self 
         cancelButtonTitle:@」OK」 
         otherButtonTitles:nil]; 
      [alert show]; 
      [alert release]; 
      break; 
     case MessageComposeResultSent: 

      break; 
     default: 
      break; 
    } 

    [self dismissModalViewControllerAnimated:YES]; 
} 

3)如果你是on> iOS6.0「old」presentModalViewController:動畫已棄用,因此更改爲presentViewController:animated:completion:由於Xcode也指出了這一點。

+0

很多關於wait_fences錯誤的SO文章,我的工作測試也提出了一個wait_fence錯誤。如果您的應用完全在設備上運行,您可以忽略此消息(例如根據這篇SO文章:http://stackoverflow.com/a/9046838/2129209) – nzs 2013-04-23 14:14:41

+0

另外其他人說,一些延遲可以幫助呈現模態視圖,因爲iOS框架可能有一些資源運行問題時,快速呈現模態視圖。所以我嘗試了你的代碼,包括:[self performSelector:@selector(showmsg)withObject:nil afterDelay:0.5];並使消息聚合器顯示方法變爲showmsg。仍wait_fences錯誤即將到來,但測試應用程序正常工作,很好地發送短信。 – nzs 2013-04-23 14:17:58

相關問題