在我的新 iOS 项目中,我希望最终用户能够MMS text and/or images
(来自 TextField)在 UIButton Action 中。我见过具有此功能的类似应用程序(带有文本,还没有看到带有图像的应用程序)。
我在谷歌搜索但找不到如何做到这一点,非常感谢任何帮助
在我的新 iOS 项目中,我希望最终用户能够MMS text and/or images
(来自 TextField)在 UIButton Action 中。我见过具有此功能的类似应用程序(带有文本,还没有看到带有图像的应用程序)。
我在谷歌搜索但找不到如何做到这一点,非常感谢任何帮助
这将正常工作
MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.persistent = YES;
pasteboard.image = [UIImage imageNamed:@"PDF_File.png"];
NSString *phoneToCall = @"sms:";
NSString *phoneToCallEncoded = [phoneToCall stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSURL *url = [[NSURL alloc] initWithString:phoneToCallEncoded];
[[UIApplication sharedApplication] openURL:url];
if([MFMessageComposeViewController canSendText]) {
NSMutableString *emailBody = [[NSMutableString alloc] initWithString:@"Your Email Body"];
picker.messageComposeDelegate = self;
picker.recipients = [NSArray arrayWithObject:@"123456789"];
[picker setBody:emailBody];// your recipient number or self for testing
picker.body = emailBody;
NSLog(@"Picker -- %@",picker.body);
[self presentModalViewController:picker animated:YES];
NSLog(@"SMS fired");
}