Sharing attachments using the Gmail extension

I am trying to use an image in my application using Gmail sharing extension

. Everything works fine, except for the recipient of the email receiving the wrong file.

A sample project can be downloaded from here .

Using iOS 8.3

, Xcode 4.6.3

,Gmail 4.0

The general 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];

      

Here is the list of activities as follows:

UIActivityViewController sheet

Pressing the Gmail button shows:

Gmail extension with image attached

And the letter comes in like this:

Received email showing malformed attachmentUnable to open image

But it's ok if I try to use iOS Mail.app:

Mail.app with attached imageReceived email showing correct attachment

+3


source to share





All Articles