How can my app send MMS with a photo?

旧街凉风 提交于 2019-11-30 19:29:00

This is not possible with the current MessageUI API. The MSMessageComposeViewController doesn't accept attachments like the Mail View controller.

Manu's answer is good for iOS6, but for iOS7 they've finally made the user-flow easy:

MFMessageComposeViewController* composer = [[MFMessageComposeViewController alloc] init];
composer.messageComposeDelegate = self;
[composer setSubject:@"My Subject"];

// These checks basically make sure it's an MMS capable device with iOS7
if([MFMessageComposeViewController respondsToSelector:@selector(canSendAttachments)] && [MFMessageComposeViewController canSendAttachments])
{
    NSData* attachment = UIImageJPEGRepresentation(myImage, 1.0);

    NSString* uti = (NSString*)kUTTypeMessage;
    [composer addAttachmentData:attachment typeIdentifier:uti filename:@"filename.jpg"];
}

[self presentViewController:composer animated:YES completion:nil];
Manohar Perepa

You can send MMS like this...

UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.persistent = YES;
pasteboard.image = [UIImage imageNamed:@"PDF_File.png"];


NSString *phoneToCall = @"sms:";
NSString *phoneToCallEncoded = [phoneToCalll stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSURL *url = [[NSURL alloc] initWithString:phoneToCallEncoded];
[[UIApplication sharedApplication] openURL:url];   

For more info you can see this link :

https://stackoverflow.com/a/12739608/1443976

You should try reading up on the MMS standard (MMS is a standard defined in 3GPP (http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/) and in Wapforum (http://www.wapforum.org/what/technical.htm). In Forum Nokia there's also documentation (How to create MMS services) that help you to understand what it is (http://www.forum.nokia.com/main/1,35452,1_2_7_1,00.html))

But basically the clue is to create a zip file with files in certain folders and with certain names. Then you need to invoke the sending of the whole file, the rest should be automagically handled by the recipient.

Keep in mind it's been years since I have anything to do with MMS, so some things might have changed.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!