Firebase 管理下载 API 不可用
Firebase manage download API not available
我正在尝试使用暂停、恢复和取消 API 来管理来自 Firebase 存储的下载,记录在此处:
https://firebase.google.com/docs/storage/ios/download-files#manage_downloads
我的下载工作正常,但我无法访问这些功能中的任何一个,有人知道如何访问这些功能吗?
var storageRef: FIRStorageReference? = nil
var pathReference: FIRStorageReference? = nil
func downloadImage(imageLocation: String) {
let saveLocation = NSURL(fileURLWithPath: String(HelperFunctions.getDocumentsDirectory()) + "/" + imageLocation)
storageRef = FIRStorage.storage().reference()
pathReference = storageRef!.child(imageLocation)
pathReference!.writeToFile(saveLocation) { (URL, error) -> Void in
}
取消、暂停或恢复方法适用于 FIRStorageDownloadTask class,它由 writeToFile method 返回,因此,在您的情况下:
let task = pathReference!.writeToFile(saveLocatio....
task.pause()
task.cancel()
task.resume()
应该可以
祝你好运!
我正在尝试使用暂停、恢复和取消 API 来管理来自 Firebase 存储的下载,记录在此处:
https://firebase.google.com/docs/storage/ios/download-files#manage_downloads
我的下载工作正常,但我无法访问这些功能中的任何一个,有人知道如何访问这些功能吗?
var storageRef: FIRStorageReference? = nil
var pathReference: FIRStorageReference? = nil
func downloadImage(imageLocation: String) {
let saveLocation = NSURL(fileURLWithPath: String(HelperFunctions.getDocumentsDirectory()) + "/" + imageLocation)
storageRef = FIRStorage.storage().reference()
pathReference = storageRef!.child(imageLocation)
pathReference!.writeToFile(saveLocation) { (URL, error) -> Void in
}
取消、暂停或恢复方法适用于 FIRStorageDownloadTask class,它由 writeToFile method 返回,因此,在您的情况下:
let task = pathReference!.writeToFile(saveLocatio....
task.pause()
task.cancel()
task.resume()
应该可以
祝你好运!