我似乎对内置的消息编写器有问题。我正试图通过MFMessageComposeViewController发送短信,其他一切似乎工作正常但是在作曲家打开后消息文本字段丢失了(我可以看到收件人)。
这可能是个错误吗?我使用的是6.1.3的iPhone 5。
我如何称呼作曲家:
MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init];
if([MFMessageComposeViewController canSendText])
{
NSString* phoneNumber = [selectedContact getSMSPhoneNumber];
if(![phoneNumber isEqualToString: @"[None]"]){
controller.body = @"Dude this is some text";
controller.recipients = [NSArray arrayWithObjects: phoneNumber, nil];
controller.messageComposeDelegate = self;
[self presentViewController:controller animated:YES completion:nil];
}else{
// Not yet implemented
}
}
MFMessageComposeViewControllerDelegate:
- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
{
switch (result) {
case MessageComposeResultCancelled:
NSLog(@"Cancelled");
break;
case MessageComposeResultFailed:
[self showErrorAlert];
break;
case MessageComposeResultSent:
break;
default:
break;
}
[self dismissViewControllerAnimated:YES completion: nil];
}
提前谢谢
答案 0 :(得分:-1)
也许您可以测试它是否有效使用此代码来设置bodie
NSString *emailBody = @"Your string";
[controller setMessageBody:emailBody isHTML:NO];