Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIActivityViewController cannot add image to imessage

I'm using UIActivityViewController to share image on ios 6 and my code

        UIImage *shareImage = [UIImage imageNamed:@"myImage.png"];

        // Init array
        NSMutableArray *items = [NSMutableArray new];
        [items addObject:@""];
        [items addObject:shareImage];

        // Add image to paste board
        UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
        pasteboard.persistent = YES;
        pasteboard.image = shareImage;

        UIActivityViewController *activityVC = [[UIActivityViewController alloc]initWithActivityItems:items applicationActivities:nil];

        //This is an array of excluded activities to appear on the UIActivityViewController
        activityVC.excludedActivityTypes = @[UIActivityTypePostToWeibo,
                                             UIActivityTypePrint,
                                             UIActivityTypeCopyToPasteboard,
                                             UIActivityTypeAssignToContact,
                                             UIActivityTypeSaveToCameraRoll];

        [self presentViewController:activityVC animated:TRUE completion:nil];

Everything working fine but cannot paste shareImage to iMessage. I don't know why? Thank for your help!

like image 333
crz Avatar asked Mar 27 '13 10:03

crz


1 Answers

As others have said, iMessage only supports text, not images. Although it sounds like in iOS7, it does work.

I know personally I've gotten it to work with OvershareKit: https://github.com/overshare/overshare-kit .

It of course adds a bit of overhead but allows you to share with just about every medium there is with their slick interface/APIs.

like image 56
valheru Avatar answered Sep 27 '22 19:09

valheru