相关疑难解决方法(0)

使用Alamofire 4.0下载文件(Swift 3)

在较旧版本的Alamofire中.这是我下载文件的方式

    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);
    }
Run Code Online (Sandbox Code Playgroud)

但是现在在新版本中,我的代码完全无法使用,并且Alamofire库中没有类似的功能.

有什么想法吗?

ios swift alamofire alamofireimage swift3

24
推荐指数
6
解决办法
4万
查看次数

标签 统计

alamofire ×1

alamofireimage ×1

ios ×1

swift ×1

swift3 ×1