首页 > 代码库 > 调用iPhone的短信
调用iPhone的短信
不传递短信内容,可以调用下面的方法:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://466453"]];//sms://电话号码
下面的方法会传递欲发送短信的内容
- (IBAction)sendSMSAction:(id)sender { [self sendSMS:@"hahahahahha" recipientList:@[@"133..."]];//recipientList:短信接收人的电话号码数组}- (void)sendSMS:(NSString *)bodyOfMessage recipientList:(NSArray *)recipients{ MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init]; if([MFMessageComposeViewController canSendText]) { controller.body = bodyOfMessage; controller.recipients = recipients; controller.messageComposeDelegate = self;// [self presentModalViewController:controller animated:YES]; [self presentViewController:controller animated:YES completion:nil]; }}// 处理发送完的响应结果- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result{ [self dismissViewControllerAnimated:YES completion:nil]; if (result == MessageComposeResultCancelled) { NSLog(@"message cancelled"); } else if (result == MessageComposeResultSent) { NSLog(@"message sent"); } else { NSLog(@"message failed"); }}
原文:http://blog.csdn.net/hopedark/article/details/7970421
调用iPhone的短信
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。