I'm trying to share both a csv and a pdf file from my iPhone app (tried from both iPhone SE and iPhone X) to my Mac Pro 2018 using AirDrop from the UIActivityViewCointroller, but it fails. I read a post from 2016 in another forum stating the same issue with simultaneously sending multiple different object types with AirDrop.
Anyone who knows if there's a workaround to fix this problem today or if it's still a restriciton in AirDrop?
// Write to the temporary file.
csvText.write(to: path, atomically: true, encoding: String.Encoding.utf8)
DispatchQueue.main.async {
let f = self.myEVAChartView.getChartImage(transparent: false)!
let pdfCreator = PDFCreator(title: (self.title ?? "No title"), body: (self.note ?? "No notes"), image: f, contact: mail)
let pdfData = pdfCreator.createReport()
// Init Activity view controller.
let activity = UIActivityViewController(
activityItems: [path, pdfData],
applicationActivities: nil
)
//Show the Activity view controller.
self.progressHUD.hide()
activity.popoverPresentationController?.barButtonItem = sender
activity.excludedActivityTypes = [.addToReadingList, .assignToContact, .copyToPasteboard, .markupAsPDF, .message, .openInIBooks, .postToFlickr, .postToTencentWeibo, .postToTwitter, .postToFacebook, .postToVimeo, .postToWeibo, .print, .saveToCameraRoll]
self.present(activity, animated: true, completion: nil)