我有一個視圖控制器「Paircontroller」呈現的MFMessageComposeViewController,像這樣:messageComposeViewController didFinishWithResult委託方法不會被調用
NSArray *recpts = [[NSArray alloc]initWithObjects:phone.text, nil];
MFMessageComposeViewController *mcontr = [[MFMessageComposeViewController alloc]init];
mcontr.body = @"Sign up for our app!";
mcontr.recipients = recpts;
mcontr.subject = @"hey!";
mcontr.delegate = self;
[self presentViewController:mcontr animated:YES completion:^{
}];
這個視圖控制器的接口如下所示:
@interface PairViewController : UIViewController<UITextFieldDelegate,CustomIOS7AlertViewDelegate, UINavigationControllerDelegate, MFMessageComposeViewControllerDelegate>
@end
內視圖控制器的實現,我已經定義了委託方法 - (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
如下:
- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
{
switch (result) {
case MessageComposeResultCancelled:
NSLog(@"Cancelled");
break;
case MessageComposeResultFailed:
NSLog(@"unknown error sending m");
break;
case MessageComposeResultSent:
NSLog(@"Message sent successfully");
break;
default:
break;
}
[self dismissViewControllerAnimated:YES completion:^{}];
}
但是,委託方法沒有被調用(斷點未命中,NSLogs也沒有被命中)。
有人可以幫我解釋爲什麼這不起作用嗎?
謝謝!
C
該消息編輯器在發送消息後被解僱了嗎? – 2015-02-09 23:49:53