gpt4 book ai didi

ios - MFMessageComposeViewController 不工作

转载 作者:可可西里 更新时间:2023-11-01 05:41:45 26 4
gpt4 key购买 nike

我有一个获取一个参数然后发送消息的简单方法。它不起作用。

代码:

- (void)sendSMS:(NSString *)text {
MFMessageComposeViewController *viewController = [[MFMessageComposeViewController alloc] init];
viewController.body = text;
viewControllerM.mailComposeDelegate = self;
[self presentViewController:viewController animated:YES completion:nil];
}

怎么了?

最佳答案

您需要设置委托(delegate):

MFMessageComposeViewController *controller = [[[MFMessageComposeViewController alloc] init] autorelease];
if([MFMessageComposeViewController canSendText])
{
controller.body = @"YO";
controller.recipients = [NSArray arrayWithObjects:@"5625555555", nil];
controller.messageComposeDelegate = self;

[self presentViewController:controller animated:YES completion:nil];
}

关于ios - MFMessageComposeViewController 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14532747/

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