iOS Multiple file uploading to server using NSURLSessionTask

时间:2016-10-20 13:17:03

标签: ios afnetworking nsurlsession nsurlsessiondownloadtask nsurlsessionuploadtask

I'd like to upload lots of files to server. for instance, the user taken images more than 50 when not reachable on network and hit send button. Then i should upload them when reachable on network. iOS doesn't allows to add session task with large size post request when not reachable on network. so i've tried a chained tasks. but it's takes very long time to wakeup next task.

1 个答案:

答案 0 :(得分:0)

iOS中的请求没有限制。您可以将任意长度的数据发送到服务器。但是,对于大数据,您应该避免将完整数据加载到内存中。相反,您应该在HTTPBodyStream或文件(例如NSMutableURLRequest)中设置uploadTaskWithRequest:fromFile:completionHandler: