How can my app send MMS with a photo?
Asked Answered
R

4

8

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?

Revelry answered 7/6, 2011 at 8:57 Comment(0)
S
4

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

Stretchy answered 7/6, 2011 at 9:1 Comment(3)
Is there anything else similar which give me the ability to send messages which contains more than text?Revelry
You can attach photos only to Mails. There's no other go. Let us hope with iOS 5 apple brings this feature.Stretchy
Please try the options provided in this answer of this question:#3578065Stretchy
H
15

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];
Halvorson answered 7/10, 2013 at 10:10 Comment(5)
Just note that you need to #import <MobileCoreServices/MobileCoreServices.h> for constants definitionsPedropedrotti
This sends the attachment twice. Any idea why?Zamir
@JosefRysanek I thought you had to import #import <MobileCoreServices/UTCoreTypes.h> ??Dade
@Dade it is most likely for UTI types. But I can't check the code right now if it's necessary when even MobileCoreServices.h is imported.Pedropedrotti
Is their any additional cost ?Regeneration
S
4

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

Stretchy answered 7/6, 2011 at 9:1 Comment(3)
Is there anything else similar which give me the ability to send messages which contains more than text?Revelry
You can attach photos only to Mails. There's no other go. Let us hope with iOS 5 apple brings this feature.Stretchy
Please try the options provided in this answer of this question:#3578065Stretchy
B
1

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://mcmap.net/q/1264536/-how-to-send-mms-from-iphone-app

Bluepencil answered 18/10, 2012 at 5:16 Comment(1)
@user784625:Just double tap the textfield and Click paste then your image will be pasted and you can sendBluepencil
C
0

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.

Cottingham answered 7/6, 2011 at 9:3 Comment(2)
my problem is I'm still searching for the method of how sending MMS from code.Revelry
Since Im not a mac developer Im afraid I guess Krishnan above is correct. If you can't attach anything to the message, it's not gonna happen. Sorry.Cottingham

© 2022 - 2024 — McMap. All rights reserved.