weiboyuan
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];
        }

分类:

技术点:

相关文章:

  • 2021-09-27
  • 2021-10-16
  • 2021-11-18
  • 2021-11-11
  • 2021-11-11
  • 2021-12-04
  • 2021-11-13
  • 2021-11-13
猜你喜欢
  • 2021-10-16
  • 2021-11-13
  • 2021-12-15
  • 2021-09-27
  • 2021-12-15
  • 2021-11-04
  • 2021-09-27
相关资源
相似解决方案