Alamofireでダウンロードした後に.pdf
ファイルをダウンロードしようとしています。しかし、私は "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にから開いているファイルを必要とする...
UIDocumentInteractionControllerのことを聞きましたの?それを読んでみてください。私はあなたが必要なものを信じています:)幸せなコーディング:) –
あなたはすでに何をしているかを示すべきです。 –
を更新してください。 @SandeepBhandariを読んでください – FireUser