This bug is fixed by WhatsApp team on 23rd May, 2016 (build no. 2.16.4).
Unable to share NSString object using UIActivityViewControll
You might wanna try sharing the local URL of the item you're trying to share. For example, if you'd like to share a pdf, don't try to share it's NSData or Data object, WhatsApp still does show that error for that. Instead, if you share the local URL of it, WhatsApp recognizes it and shares it well.
I must note that many apps including native Mail, Gmail, Slack, GDrive etc. do recognize the pdf if you try to share the Data object.
For example:
After downloading a PDF, bind its URL into a variable called fileURL:
var fileURL = URL(string: url)
let destination: DownloadRequest.DownloadFileDestination = { _, _ in
let documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
fileURL = documentsURL.appendingPathComponent("AWESOME_PDF.pdf")
return (fileURL!, [.removePreviousFile, .createIntermediateDirectories])
}
Then you can simply share the fileURL instead:
let activityViewController = UIActivityViewController(
activityItems: [fileURL!],
applicationActivities: nil
)
WhatsApp will recognize the PDF.
Hope this helps!