[英]MFMessageComposeViewController not working
I have a simple method that gets one argument and then sends a message. 我有一个简单的方法,获取一个参数,然后发送一条消息。 It is not working.
它不起作用。
Code: 码:
- (void)sendSMS:(NSString *)text {
MFMessageComposeViewController *viewController = [[MFMessageComposeViewController alloc] init];
viewController.body = text;
viewControllerM.mailComposeDelegate = self;
[self presentViewController:viewController animated:YES completion:nil];
}
What's wrong? 怎么了?
You need to set the 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];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.