In älteren Versionen von Alamofire. Dies ist, wie ich Datei herunterladenDatei herunterladen mit Alamofire 4.0 (Swift 3)
let destinationPath = Alamofire.Request.suggestedDownloadDestination(directory: .documentDirectory, domain: .userDomainMask);
Alamofire.download(.GET, urlString, destination: destinationPath)
.progress { bytesRead, totalBytesRead, totalBytesExpectedToRead in
// print(totalBytesRead)
}
.response { request, response, _, error in
let downloadedFilePath = destinationPath(URL(string: "")!, response!);
NSUserDefaultsHelper.saveURL(downloadedFilePath, key: urlString);
completion(downloadedFilePath, true);
}
Aber jetzt in der neuen Version, mein Code ist völlig unbrauchbar und es gibt keine ähnliche Funktion in der Alamofire Bibliothek.
Irgendwelche Ideen bitte?
Wenn ich Google 'Datei herunterladen Mit Alamofire 4.0 (Swift 3)', ich einen Link zu Alamofire offizieller Dokumentation erhalten, die ein [Beispiel] hat (https://github.com/Alamofire/Alamofire#downloading- Daten in eine Datei) zum Herunterladen einer Datei. Ist das nicht nützlich? –