문제

I'm wondering how to use AFNetworking to make a POST request with a file, a few parameters and progress report of the upload.

AFURLSessionManager's uploadTaskWithRequest:fromFile:progress:completionHandler works for POST upload with progress, but I cannot figure out how to add the POST parameters.

I've also looked into AFHTTPSessionManager's POST:parameters:constructingBodyWithBlock:success:failure:, but that doesn't appear to be able to report upload progress.

How do I get the best of both worlds?

도움이 되었습니까?

해결책

Look at using a combination of uploadTaskWithStreamedRequest:progress:completionHandler: and multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top