Ben Sullivan Ben Sullivan - 1 year ago 148
Swift Question

Firebase manage download API not available

I am trying to manage downloads from Firebase Storage using the Pause, Resume and Cancel API which is documented here:

My downloads are working perfectly but I have no access to any of these functions, does anybody know how to access these?

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 =

pathReference = storageRef!.child(imageLocation)

pathReference!.writeToFile(saveLocation) { (URL, error) -> Void in


Answer Source

The cancel, pause or resume methods are for the FIRStorageDownloadTask class, which is returned by the writeToFile method so, in your case:

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

Should work

Best of luck!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download