我试图打开一个.pdf
文件,下载后用Alamofire下载。但我见过只使用“webview”。因此,该应用程序消耗大量内存并且不可行。如何在iOS中打开文件?
我想要的是用本机设备应用程序打开它。有什么建议么?谢谢。
编辑:这是我的下载文件中的代码:
var localPath: NSURL?
Alamofire.download(.GET, url, destination: { (temporaryURL, response) in
let directoryURL = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0]
let pathComponent = response.suggestedFilename
localPath = directoryURL.URLByAppendingPathComponent(pathComponent!)
return localPath!
})
.response { (request, response, _, error) in
if error != nil
{
// got an error in getting the data, need to handle it
print("Error: \(error!)")
}
//print(response)
print("Download file en:\(localPath!)")
self.view.hideToastActivity()
//self.actioncall()
}
}
我需要的localPath打开文件...
赫德?如果不尝试阅读。我相信多数民众赞成你需要:)快乐编码:) –
你应该显示你已经做了什么。 –
更新操作。我会读@SandeepBhandari – FireUser