How to send picture as an attachment with sms programmatically?
I want to send a picture via an iphone开发者_如何学运维 app.
Since it's not possible to send MMS, I found some answers speaking about sending the picture as an attachment with the SMS. How to do that programmatically?
Here is the code:
MFMessageComposeViewController *sms = [[MFMessageComposeViewController alloc]init];
[sms setMessageComposeDelegate:self];
[sms setRecipients:[NSArray arrayWithObject:@"123-4567"]];
[sms setSubject:@"Subject"];
[sms setBody:@"Body"];
[sms addAttachmentData:myData typeIdentifier:@"type" filename:myFile];
[sms setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentViewController:sms animated:YES completion:NO];
Hope it helps.
精彩评论