Swift crash wen tapping “Open in Instagram” while using UIDocumentInteractionController Swift crash wen tapping “Open in Instagram” while using UIDocumentInteractionController swift swift

Swift crash wen tapping “Open in Instagram” while using UIDocumentInteractionController


I think your are right.I have the same problem.

before begin the share function, you must create a global variable from UIDocumentInteractionController:

var interactionController: UIDocumentInteractionController?@IBAction func instagramShareButton(sender: AnyObject) {    ...    interactionController = UIDocumentInteractionController(URL: fileURL)    interactionController!.UTI = "com.instagram.exclusivegram"    let msgBody = "My message"    interactionController!.annotation = NSDictionary(object: msgBody, forKey: "InstagramCaption")    interactionController!.presentOpenInMenuFromRect(rect, inView: self.view, animated: true)}

This works for me!