发送短信后,我会收到短信反馈。我复制了它,我想粘贴到应用程序中。但是我无法返回应用程序 - “取消”按钮变为灰色 - 不活动。
- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result {
switch (result)
{
case MessageComposeResultCancelled:
NSLog(@"Result: canceled");
[self dismissViewControllerAnimated:YES completion:nil];
break;
case MessageComposeResultSent:
NSLog(@"Result: sent");
break;
case MessageComposeResultFailed:
NSLog(@"Result: failed");
break;
default:
NSLog(@"Result: not sent");
break;
}
// [self dismissViewControllerAnimated:YES completion:nil];
}
-(void)sms{
MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init] ;
if([MFMessageComposeViewController canSendText])
{
controller.body = @"message";
controller.recipients = [NSArray arrayWithObjects:@"12344321", nil];
controller.messageComposeDelegate = self;
[self presentViewController:controller animated:YES completion:nil];
}
}
答案 0 :(得分:4)
您需要取消注释MFMessageComposeViewController
这应该有效,并会通过驳回switch statement
并根据- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
中的tableImageArray
行动将您带回应用程序。