码迷,mamicode.com
首页 > 移动开发 > 详细

iOS 调用带内容的短信页面

时间:2015-01-29 17:21:59      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:

- (void)inviteBtnMethod

{

    NSLog(@"inviteBtnMethod  %@",myInviteCode.text);

  //  [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:"]];

    NSString *str = @"我邀请你参与新鲜,新鲜是一个独立的模特平台。帮你找到更多的工作,注册时候用我的邀请码";

    NSString *inviteMessage = [NSString stringWithFormat:@"%@%@",str,myInviteCode.text];

    [self sendSMS:inviteMessage recipientList:nil];

//     [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://800888"]];

    

}

- (void)sendSMS:(NSString *)bodyOfMessage recipientList:(NSArray *)recipients

{

    NSLog(@"bodyOfMessage-< %@",bodyOfMessage);

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

    

    if([MFMessageComposeViewController canSendText])

        

    {

        

        controller.body = bodyOfMessage;

        

        controller.recipients = recipients;

        

        controller.messageComposeDelegate = self;

        

        [self presentModalViewController:controller animated:YES];

        

    }

    

}

 

// 处理发送完的响应结果

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

{

    [self dismissModalViewControllerAnimated:YES];

    

    if (result == MessageComposeResultCancelled)

        NSLog(@"Message cancelled");

        else if (result == MessageComposeResultSent)

            NSLog(@"Message sent");

            else 

                NSLog(@"Message failed")  ;

               

//                }

}

iOS 调用带内容的短信页面

标签:

原文地址:http://www.cnblogs.com/lude/p/4260389.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!