I need to open a file from web url and open in other apps that have installed in the device using UIDocumentInteractionController
var controller:UIDocumentInteractionController?
self.controller? = UIDocumentInteractionController.init(URL: (NSURL(string: self.filesUrl))!)
where self.filesUrl = self.filesDetailArrayResponse.valueForKey("url")
as! NSArray
is from the json response
But self.controller
returning nil value
It is not possible do it with web URL, the file must be in the local filesystem as a file URL. From the apple documentation:
UIDocumentInteractionController
var url: URL? { get set }
The URL identifying the target file on the local filesystem.
So how to solve it, download the file, the write it in the local filesystem and then give the local URL to the UIDocumentInteractionController
(for example with: https://stackoverflow.com/a/16392475/1791179)