AFNetworking을 사용하여 큰 파일을 내 iPad 앱에 다운로드하고 있습니다.AFNetworking이 다운로드를 시작하지 않습니다.
AFHTTPRequestOperation 인스턴스가이 파일을 다운로드하는 데 사용됩니다. 아래 참조 코드입니다 -
//request is the NSRequest object for the file getting downloaded AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:^(AFHTTPRequestOperation *operation, id responseObject) { } failure:^(AFHTTPRequestOperation *operation, NSError *error) { }]; //here path variable is the location where file would be placed on download operation.outputStream = [NSOutputStream outputStreamToFileAtPath:path append:YES]; //since this class is subclass of AFHTTPClient so the operation is added to request queue [self enqueueHTTPRequestOperation:operation];
이제 여기에 문제가 내가 일시 중지를 시도하고 기능 아래 사용하여이 다운로드를 재개 할 때 pauseDownload 기능이 이력서 다운로드가 예상대로 작동하지 않습니다하지만 제대로 작동하고 그것은 처음부터 다운로드가 시작되는 것처럼 보였습니다. 어디에서 시작했는지에 관해서는 그것이 떠난 곳에서 다시 시작될 것입니다. 여기에 어떤 문제가있을 수 있습니까?
-(void)pauseDownload{ [operation pause]; } -(void)resumeDownload{ [operation resume]; }
앱을 종료하고 다시 시작할 때도 작동합니까? – openfrog
@openfrog 예 앱이 종료되어 다시 시작될 때도 작동합니다. –
이 나를 도와주세요. [self enqueueHTTPRequestOperation : operation]; –