Send image + text to iMessage in ios programmatically?

is it possible to send image + text to iMessage in ios programmatically?

If possible, can someone help me?

+2
source share
1 answer

Yes, you can do it, just like doing by mail, just do it

#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];
+3
source

Source: https://habr.com/ru/post/1017368/


All Articles