Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can my app send MMS with a photo?

I would like to compose a message from my app which I can include a photo, for example: I entered my album in the IPhone and open a photo I can click on option and then on MMS tab and the photo will be added in a message and I can send it then to a whatever contact I want. what I want is that when I click on a button on my app, a message window will open with a photo from my resources in the XCode, how can I do that?

like image 388
user784625 Avatar asked Jun 07 '11 08:06

user784625


People also ask

How do I send a picture MMS?

To send an MMS select the photo from the gallery application and touch the share icon. Select Messages, you will be given an option of recent conversations or select 'New message'. Add text to the message if required. Click the button and your MMS will be sent.

Can you send photos by MMS?

MMS stands for Multimedia Messaging Service. MMS allows you to add all kinds of rich media right inside your messages including images, gifs, videos, and audio files.


2 Answers

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];
like image 105
Mete Avatar answered Sep 23 '22 14:09

Mete


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

like image 37
RK- Avatar answered Sep 22 '22 14:09

RK-