发送图片+文本在iMessage在ios中编程? [英] send picture + text in iMessage in ios programatically?

查看:432
本文介绍了发送图片+文本在iMessage在ios中编程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有可能在ios中以ios编程方式发送图片+文本吗?

is there any possibility to send picture + text in iMessage in ios programatically?

如果可能,任何人都可以帮助我吗?

if it is possible can anyone help me?

推荐答案

是的,你可以这样做,就像做邮件一样。

Yes you can do it , its same like doing for mail just do this

#import <MessageUI/MFMessageComposeViewController.h>

MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
picker.messageComposeDelegate = self;

picker.recipients = [NSArray arrayWithObject:@"123456789"];   // your recipient number  or self for testing
picker.body = @"test from OS4";
NSData*imageData=[NSData dataWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@"image" ofType:@"png"]];
[picker addAttachmentData:imageData typeIdentifier:(NSString *)kUTTypePNG   filename:@"image.png"];
[self presentModalViewController:picker animated:YES];

这篇关于发送图片+文本在iMessage在ios中编程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆