开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜