2013-10-21 7 views
6

私はこのようにSMSをプログラム的に長時間送信しています。 iOS6では問題なく動作しました。iOS7でSMSを送信する - iOS6からアップグレードした後の問題

しかし、今iOS7にアップデートした後、一部のユーザーはアプリで問題を抱えています。彼らは、アプリケーションを削除する必要があります - iPhoneを再起動 - それを再インストールし、それが動作します。電話を再起動せずにそれを再インストールするだけでも動作しません。

これは本当に厄介な問題の原因になりますか?

さらに、この手順の後にいくつかのSMSを送信することができますが、iPhone SMSダイアログが非常に遅く表示され、iPhoneが再起動されるまでSMSは再送信されません。アプリを停止して再起動するだけでは役に立ちません。私はまだiOS5.1のユーザーをサポートする必要があるので、私も展開ターゲット5.1と最新のXcode 5.0でアプリの新バージョンをリリースし

MFMessageComposeViewController *messageVC = [[MFMessageComposeViewController alloc] init]; 
[messageVC setMessageComposeDelegate:self]; 
if ([MFMessageComposeViewController canSendText]) { 

    NSString *smsString = [NSString stringWithFormat:@"bla bla bla"]; 
    messageVC.body = smsString; 
    messageVC.recipients = @[userPhone]; 
    messageVC.messageComposeDelegate = self; 
[self presentViewController:messageVC animated:YES completion:nil]; 
} 

はここで、通常のSMSコードです。

+0

この問題も発生します。あなたはその周りに何かを見つけましたか? – Teddy

+1

私は11月にバグレポートを提出しましたが、Appleはそれを無視し続けます。他のAPPはそのような場合にSMSを送信できません。Appleがこれを静かに逃れることは驚きです。 – user387184

+0

Appleにバグを報告したことはありません。どこで試してみるべきですか? – Teddy

答えて

0

問題の原因を特定するのに十分な情報がありません。 Btw、なぜmessageComposeDelegateを2回設定していますか?

これはAppleの最新のサンプルコードで、iOS 7とiOS 8を実行している自分のデバイスで修正されました。MessageUI.frameworkを必ずインポートしてください。

/* ------------------------------------------------------------------------------- 
    showSMSPicker: 
    IBAction for the Compose SMS button. 
    ------------------------------------------------------------------------------- */ 
- (IBAction)showSMSPicker:(id)sender 
{ 
    /* Checks that the current device can send SMS messages. If no, [[MFMessageComposeViewController alloc] init] will return nil and the app will 
    crash when -presentViewController:animated:completion: is called with a nil view controller */ 

    if ([MFMessageComposeViewController canSendText]) 
     // The device can send email. 
    { 
     [self displaySMSComposerSheet]; 
    } 
    else 
     // The device can not send email. 
    { 
     self.feedbackMsg.hidden = NO; 
     self.feedbackMsg.text = @"Device not configured to send SMS."; 
    } 
} 


/* ------------------------------------------------------------------------------- 
    displayMailComposerSheet 
    Displays an SMS composition interface inside the application. 
    ------------------------------------------------------------------------------- */ 

- (void)displaySMSComposerSheet 
{ 
    MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init]; 
    picker.messageComposeDelegate = self; 

    /* One or more preconfigured recipients can be specified. The user has the option to remove 
    or add recipients from the message composer view controller */ 
    /* picker.recipients = @[@"Phone number here"]; */ 

    // Message body 
    picker.body = @"This is a message about how great this app is. Please download it by clicking on the link below."; 

    [self presentViewController:picker animated:YES completion:nil]; 
} 

/* ------------------------------------------------------------------------------- 
    messageComposeViewController:didFinishWithResult: 
    Dismisses the message composition interface when users tap Cancel or Send. 
    Proceeds to update the feedback message field with the result of the 
    operation. 
    ------------------------------------------------------------------------------- */ 

- (void)messageComposeViewController:(MFMessageComposeViewController *)controller 
       didFinishWithResult:(MessageComposeResult)result 
{ 
    self.feedbackMsg.hidden = NO; 
    // Notifies users about errors associated with the interface 
    switch (result) 
    { 
     case MessageComposeResultCancelled: 
      self.feedbackMsg.text = @"Result: SMS sending canceled"; 
      break; 
     case MessageComposeResultSent: 
      self.feedbackMsg.text = @"Result: SMS sent"; 
      break; 
     case MessageComposeResultFailed: 
      self.feedbackMsg.text = @"Result: SMS sending failed"; 
      break; 
     default: 
      self.feedbackMsg.text = @"Result: SMS not sent"; 
      break; 
    } 

    [self dismissViewControllerAnimated:YES completion:NULL]; 
} 
関連する問題