如何从iPhone应用程序发送彩信

Gre*_*tiz 7 iphone mms objective-c ios

在我的新iOS项目中,我希望最终用户能够MMS text and/or images(来自TextField)在UIButton Action中.我见过类似的应用程序具有此功能(有文本,还没有看到有图像的应用程序).

我在谷歌搜索但无法找到如何做到这一点,任何帮助非常感谢

Man*_*epa 18

这样可以正常工作

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");
}
Run Code Online (Sandbox Code Playgroud)

  • @VenkatManohar如果我关注你,你说最终用户必须手动粘贴它.无论如何以编程方式做到这一点? (4认同)