get progress from dataTaskWithURL in swift

后端 未结 6 1167
庸人自扰
庸人自扰 2020-11-30 03:49

Is there any way to get progress from dataTaskWithURL in swift while the data is downloading?

NSURLSession.sharedSession().dataTaskWithURL(...)         


        
6条回答
  •  难免孤独
    2020-11-30 04:49

    for the data been download you need to set the NSURLSessionDownloadDelegate and to implement URLSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)

    There is a nice tutorial about it here but is in object-c.

提交回复
热议问题