iOS APP 跳转系统发送短信功能

1.导入 #import <MessageUI/MessageUI.h>

2.遵守协议 MFMessageComposeViewControllerDelegate

3.Btn action

MFMessageComposeViewController *vc = [[MFMessageComposeViewController alloc] init];
    // 设置短信内容
    vc.body = @"我想法这样的话  http://www.jianshu.com/p/0bac60cb6f38";
    
    // 设置收件人列表
    vc.recipients = @[@"15156884539"];  // 号码数组
    // 设置代理
    vc.messageComposeDelegate = self;
    // 显示控制器
    [self presentViewController:vc animated:YES completion:nil];
4.
- (void)messageComposeViewController:(MFMessageComposeViewController*)controller didFinishWithResult:(MessageComposeResult)result
{
    // 关闭短信界面
    [controller dismissViewControllerAnimated:YES completion:nil];
    if(result == MessageComposeResultCancelled) {
        NSLog(@"取消发送");
    } else if(result == MessageComposeResultSent) {
        NSLog(@"已经发出");
    } else {
        NSLog(@"发送失败");
    }
}

 

特别声明:文章多为网络转载,资源使用一般不提供任何帮助,特殊资源除外,如有侵权请联系!
技术狗 » iOS APP 跳转系统发送短信功能