Nsurl *url = [Nsurl urlwithstring:@ "Http://cdn.sencha.com/ext/gpl/ext-4.2.1-gpl.zip"]; Nsurlrequest *request = [Nsurlrequest Requestwithurl:url]; Download request Afhttprequestoperation *operation = [[Afhttprequestoperation alloc] initwithrequest:request]; Correct download path [self getimagepath:@ "3.zip"]//Wrong path//Nsarray *path = Nssearchpathfordirectoriesindomains (nsdocumentd Irectory, Nsuserdomainmask, YES);//NSString *docpath = [path objectatindex:0]; Operation.outputstream = [Nsoutputstream outputstreamtofileatpath:[self getimagepath:@ "3.zip"] append:YES]; Download progress Callback [Operation setdownloadprogressblock:^ (Nsuinteger bytesread, Long long totalbytesread, long long totalbytesexpe Ctedtoread) {//download progress Float progress = ((float) totalbytesread)/(Totalbytesexpectedtoread); NSLog (@ "%f", progress); }]; Success and failure callbacks [Operation setcompletionblockwithsuccess:^ (afhttprequestoperation *operation, id responseobject) {NSL OG (@ "OK"); } failure: ^ (afhttprequestoperation *operation, Nserror *error) {NSLog (@ "%@", error); }]; [Operation start];
<span style= "font-family:arial, Helvetica, Sans-serif; Background-color:rgb (255, 255, 255); " >http://stackoverflow.com/questions/14248757/ Error-domain-nscocoaerrordomain-code-512-the-operation-couldn-t-be-completed-th</span>
About afnetworking Download Progress display "The operation couldn ' t be completed. is a directory "bug handling