iOS 调用带内容的短信页面
- (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") ;
// }
}
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。