0

I like to share files (images, videos, pdf, plist, txt…) with UIActivityViewController, I am trying to share a NSData object, but it wont work. If I replace the NSData with UIImage it works.

Is it possible to add this to the UIActivityViewController: [mailer addAttachmentData:imageData mimeType:[[self.filePath lastPathComponent] pathExtension] fileName:[self.filePath lastPathComponent]];

Wain
  • 118,658
  • 15
  • 128
  • 151
David Gölzhäuser
  • 3,525
  • 8
  • 50
  • 98

1 Answers1

0

If you want to attach raw data you should use an appropriate mime type, like

application/octet-stream

And preferably set an appropriate file name and extension (like .bin )

Try this to determine the mime type for files.

Community
  • 1
  • 1
Wain
  • 118,658
  • 15
  • 128
  • 151