Sharing PDF - blank from Mail.app but OK over Airdrop

220 Views Asked by At

I'm sharing a PDF using the built in Share activity action sheet using the following code:

if let pdf = pdfData {
   let vc = UIActivityViewController(activityItems: [pdf], applicationActivities: [])
   if (vc.responds(to: #selector(getter: popoverPresentationController))) {
       vc.popoverPresentationController?.sourceView = btnShare;
   }
   self.present(vc, animated: true)
} else {
            showTextAlertWithImage...
...
}

When the sharing popover is displayed, tapping on Airdrop and sharing to a nearby computer the PDF everything works as expected.

But if I choose Mail from the sharing list the PDF is blank. Does anyone please know why?

It's the same PDF that's being shared in both situations. If it matters, the mail account is an Outlook account. Sharing the PDF through the Gmail app also produces the correct PDF, however the attachment does not include the '.pdf' file extension.

1

There are 1 best solutions below

0
On

Check how to add Content Type to your activity item you are sharing.