0

我似乎对内置的消息编辑器有问题。我正在尝试通过 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];
}

先感谢您

4

1 回答 1

-1

也许您可以测试它是否有效,使用此代码设置身体

NSString *emailBody = @"Your string";
[controller setMessageBody:emailBody isHTML:NO];
于 2013-04-17T16:39:30.027 回答