4

I'm attempting to share an image in my app using Gmail sharing extension. Everything works okay except for the recipient of the email who receives a malformed file.

Sample project can be downloaded from here.

Using iOS 8.3, Xcode 4.6.3, Gmail 4.0

Sharing code looks like this:

UIImage *image = [UIImage imageNamed:@"image"];
NSData *imageData = UIImagePNGRepresentation(image);

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

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

This presents the activity sheet like this:

UIActivityViewController sheet

Pressing Gmail button shows:

Gmail extension with image attached

And the email arrives like this:

Received email showing malformed attachment Unable to open image

But, everything is okay if I try to use iOS's Mail.app:

Mail.app with attached image Received email showing correct attachment

0 Answers0