ios - Progress block with GET and AFNetworking 3.0 is not called -
i have created subclass of afhttpsessionmanager
:
class tbnetworkclient: afhttpsessionmanager { func wordswithcompletionblock(completionblock: tberrorhandler) { querytype = .words get("words", parameters: nil, progress: { progress in print("----------") //this not called @ all, why? }, success: { sessiondatatask, response in completionblock(nil) //success called }) { sessiondatatask, error in completionblock(error) } } }
marked line not called @ all, why?
this definition above method in source code:
public func get(urlstring: string, parameters: anyobject?, progress downloadprogress: ((nsprogress) -> void)?, success: ((nsurlsessiondatatask, anyobject?) -> void)?, failure: ((nsurlsessiondatatask?, nserror) -> void)?) -> nsurlsessiondatatask?
there note:
@param progress block object executed when download progress updated. note block called on session queue, not main queue.
when print print((sessiondatatask.response as? nshttpurlresponse)?.allheaderfields)
the output following:
optional([server: apache, connection: keep-alive, content-type: text/html, date: fri, 08 jan 2016 08:58:18 gmt, content-encoding: gzip, keep-alive: timeout=1, max=100, content-length: 5663, vary: accept-encoding,user-agent])
Comments
Post a Comment