2016-07-05 69 views
2

我試圖管理使用暫停從火力地堡存儲下載,恢復和取消其記錄在這裏API:火力地堡管理下載API不可用

https://firebase.google.com/docs/storage/ios/download-files#manage_downloads

我的下載完美地工作,但我沒有訪問對任何這些功能,有沒有人知道如何訪問這些?

enter image description here

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 

} 
+0

你能爲我們粘貼完整的'pathReference'初始化嗎? –

+0

謝謝,更新的問題 –

回答

3

的取消,暫停或恢復方法是對FIRStorageDownloadTask類,它是由writeToFile method返回所以,你的情況:

let task = pathReference!.writeToFile(saveLocatio.... task.pause() task.cancel() task.resume()

應工作

祝你好運!

+0

謝謝!我應該讀過我想的文檔的前幾部分:s –