我正在尝试将邮件发送到从数据库接收到的电子邮件数组列表,当我发送收件人列表时,将填充在iOS 7
中,但是当我尝试使用iOS 5
时,收件人列表将不会填充。知道为什么吗?这是我的邮件功能
-(void)sendEmailToContacts:(NSArray *)fList withText:(NSString *)emailText withTag:(NSInteger )tag
{
if([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController *mailComposer = [[MFMailComposeViewController alloc] init];
mailComposer.view.tag=tag;
NSString *htmlBody =[NSString stringWithFormat:@"<a href=\"%@\">%@</a>",_currentAdd.contentUrl,addtext];
[mailComposer setMessageBody:htmlBody isHTML:YES];
[mailComposer setSubject:_currentMail.subject];
mailComposer.mailComposeDelegate = self;
[mailComposer setToRecipients:fList];
[self presentViewController:mailComposer animated:YES completion:nil];
}
else
{
NSLog(@"Device is unable to send email in its current state.");
}
}
我的
fList
(收件人列表)是NSArray
,这是我的fList的示例输出(
"john@gmail.com",
"mary@gmail.com",
"akhil@gmail.com",
"tester@gmail.com"
)
最佳答案
收件人应视为不可变数组。检查您的数组类型
NSArray *usersTo = [NSArray arrayWithObject: @"raja@apple.com"];
[mailComposer setToRecipients:usersTo];
关于ios - MFMailComposeViewController未在iOS 5中填充收件人,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21039933/