iOS跳转到发短信界面

时间:2022-11-09 23:30:12

      跳转到发短信界面

MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc]init];

            picker.messageComposeDelegate = self;

            //推荐的电话号码

            NSString *phoneNum = [DEFAULTS objectForKey:@"invitetel"];

            picker.recipients = @[phoneNum];

            picker.body = [NSString stringWithFormat:@"邀请验证码为%@",[DEFAULTSobjectForKey:@"verycode" ]];

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

        }

代理方法

-(void)messageComposeViewController:(MFMessageComposeViewController*)controller didFinishWithResult:(MessageComposeResult)result

{

    switch (result) {

        case MessageComposeResultSent:

            [self showHint:@"信息传送成功"];

            break;

        case MessageComposeResultFailed:

            [self showHint:@"信息传送失败"];

            break;

        case MessageComposeResultCancelled:

            [self showHint:@"信息被用户取消传送"];

            break;

        default:

            break;

    }