The didFinishWithResult delegate method of MFMessageComposeViewController shows that the message has been sent successfully, even when the device is in airplane mode or when the device has no SIM,but the message sending is failed.The delegate does not go through the failure state.Why doesnt it go to failure state?.Please give me some suggestion on this. The code is given as below:
- (void)displaySMSComposerSheet { MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init]; picker.messageComposeDelegate = self; // You can specify one or more preconfigured recipients. The user has // the option to remove or add recipients from the message composer view // controller. /* picker.recipients = @[@"Phone number here"]; */ // You can specify the initial message text that will appear in the message // composer view controller. picker.body = @"Hello from California!"; [self presentViewController:picker animated:YES completion:NULL]; }
And the DELEGATE methods are given below:
// ------------------------------------------------------------------------------- // 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]; }
For me when I press "CANCEL" or "SEND" message the correct delegates are fired. But when I switch ON the AIRPLANE Mode or the device with no SIM still the MessageComposeResultSent
Is fired. Can some one tell clearly when the MessageComposeResultFailed
is fired? Any live steps? Please kindly help me
没有评论:
发表评论