开发者

How to send picture as an attachment with sms programmatically?

开发者 https://www.devze.com 2023-03-07 23:10 出处:网络
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 th

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消