4
我正在使用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]; –