Am using UIDocumentInteractionController to share file and to add openIn option to my app , but when i press send email i got an empty email , and i got the error from consol Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior ()
if i try to save the image "save image " i got this error Couldn't get file size for (null): (null)
this is my code
var documentInteractionController:UIDocumentInteractionController?
open func ShareButtonPressed(_ sender:UIButton){
let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] + "/downloads"
let name = String(format: "%@_%@", objDownloads[currentPageIndex].modificationDate!, objDownloads[currentPageIndex].fileName!)
let url:URL = URL(fileURLWithPath: documentsPath.stringByAppendingPathComponent(name))
let documentInteractionController = UIDocumentInteractionController(url:url)
documentInteractionController.uti = objDownloads[currentPageIndex].fileName
documentInteractionController.presentOptionsMenu(from: sender.frame, in: self.view, animated: true)
documentInteractionController.delegate = self
}
and this my button code
let shareBtn = UIButton()
let shareIcon = UIImage(named: "share_icon")
shareBtn.addTarget(self, action: #selector(SKPhotoBrowser.ShareButtonPressed(_:)), for: UIControlEvents.touchUpInside)