Recently used about afnetworking download problem, by the way to write a blog, for everyone to reference and research.
Nsurlsessionconfiguration *configuration = [NsurlsessionconfigurationDefaultsessionconfiguration]; Afurlsessionmanager *manager = [[AfurlsessionmanagerAllocInitwithsessionconfiguration:configuration];Nsurl *url = [NsurlURLWithString:@ "Http://example.com/download.zip"];Nsurlrequest *request = [NsurlrequestRequestwithurl:url];Nsurlsessiondownloadtask *downloadtask = [ManagerDownloadtaskwithrequest:requestProgressNildestination:^Nsurl * (Nsurl *targetpath,Nsurlresponse *response) {Nsurl *documentsdirectoryurl = [[Nsfilemanagerdefaultmanager] urlfordirectory:nsdocumentdirectory indomain:nsuserdomainmask appropriateforurl:nil create:NO error:nil]; return [documentsdirectoryurl urlbyappendingpathcomponent:[response suggestedfilename];} completionhandler:^ (nsurlresponse *response, NSURL * FilePath, nserror *error) {nslog ( @ "File downloaded to: %@", FilePath);}];
//Restart download [downloadtask resume];
Code:
iOS Development Article-afnetworking Network Encapsulation (download)