首页 > 移动平台 > 详细

iOS 调用带内容的短信页面

时间:2015-01-29 17:20:33      阅读:237      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!