iOS发送短信

iPhone开发,发送短信的方法:
iPhone开发中,发送短信方法有二:
1。URL Scheme,这样不可以设置短信内容
1
2
3
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://10086"]];
//打电话可以这样
//[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://10086"]];
2。MFMessageComposeViewController,这样可以设置短信的内容
1
2
3
4
5
6
7
8
MFMessageComposeViewController *controller = [[[MFMessageComposeViewController alloc] init] autorelease];
        if ([MFMessageComposeViewController canSendText])        {
            if (![self.friendLabel.text isEqualToString:@"{好友}"])
                controller.recipients = [NSArray arrayWithObjects:self.friendLabel.text, nil];
                controller.body = self.shareMessageTextView.text;
                controller.messageComposeDelegate = self;
                [self presentModalViewController:controller animated:YES];
        }
上一篇:根据linux内核源码查找recv返回EBADF(errno 9)的原因


下一篇:服务器编程入门(11)TCP并发回射服务器实现 - 单线程select实现