gpt4 book ai didi

iphone - 无法设置MFMessageComposeViewController的收件人?

转载 作者:行者123 更新时间:2023-12-01 17:45:52 25 4
gpt4 key购买 nike

我有这样的方法:

void sendSMS{

if ([MFMessageComposeViewController canSendText]) {

MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];

picker.recipients = [NSArray arrayWithObject:@"0933660805"];
[picker setBody:@"Message body"];
picker.messageComposeDelegate = self;

[self.navigationController presentModalViewController:picker animated:YES];
//[picker release];

return;

}

}

邮件编辑器打开,但是收件人和邮件正文为空(下图)。任何人都知道我该如何解决它:(

最佳答案

选择这个,然后检查可能会解决您的问题

void sendSMS
{
if ([MFMessageComposeViewController canSendText]) {
MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
picker.messageComposeDelegate = self;
NSString *bodyString = nil;

NSMutableArray *toRecipients = [[NSMutableArray alloc]init];
[toRecipients addObject:@"0933660805"];
[picker setRecipients:(NSArray *)toRecipients];
[toRecipients release];

bodyString = [NSString stringWithFormat: @"Message body"];
[picker setBody:bodyString];

[self presentModalViewController:picker animated:YES];
[picker release];
}

也看看这个教程 http://blog.mugunthkumar.com/coding/iphone-tutorial-how-to-send-in-app-sms/

祝好运!

关于iphone - 无法设置MFMessageComposeViewController的收件人?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5575784/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com