标签:
- (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") ;
// }
}
标签:
原文地址:http://www.cnblogs.com/lude/p/4260389.html