I am sharing Image,video and LivePhoto using UIActivityViewController
on Different social media.
But when i am sharing LivePhoto on WhatsApp ,something like below is happening :
- when ActivityViewController present -> click on WhatsApp -> it present contact list for second and quickly dismiss and when i try to print error using
ActivityViewController
Completion handler it print something like this :
[core] SLComposeViewController remoteViewController: didTerminateWithError: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted} [core] SLComposeViewController completeWithResult: 0 [core] SLComposeViewController skipping explicit dismiss because isBeingDismissed is already 1 SLComposeViewController dealloc
I have tried with this code :
PHImageManager.default().requestImageData(for: selectedAsset, options: nil, resultHandler: { (imgData, str, image, info) in
activityItems.append(imgData!)
let activityViewController = UIActivityViewController(activityItems: activityItems, applicationActivities: nil)
activityViewController.popoverPresentationController?.sourceView = self.view // so that iPads won't crash
activityViewController.completionWithItemsHandler = {(activityType: UIActivityType?, completed: Bool, returnedItems:[Any]?, error: Error?) in
//Do whatever you want
print("activityType ----- \(activityType) || error ----- \(error)")
}
// present the view controller
DispatchQueue.main.async {
// self.present(activityViewController, animated: true, completion: nil)
self.navigationController?.present(activityViewController, animated: true, completion: nil)
}
})
can anyone help me with please.
Thank you.