6
मुझे अपने आईपैड ऐप के साथ बड़ी .zip फ़ाइलें (800 एमबी तक) डाउनलोड करने की आवश्यकता है। यदि यह रद्द किया गया है या यदि ऐप पृष्ठभूमि में है तो मैं फिर से डाउनलोड फिर से शुरू करना चाहता हूं।AFNetworking + रोकें/बड़ी फ़ाइलों को डाउनलोड करना फिर से शुरू करें
operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
operation.outputStream = [NSOutputStream outputStreamToFileAtPath:filePath append:YES];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject){
// unzip the .zip
}failure:^(AFHTTPRequestOperation *operation, NSError *error){
//Handle the error
}];
[operation setDownloadProgressBlock:^(NSInteger bytesWritten, long long totalBytesWritten,long long totalBytesExpectedToWrite) {
//update the progressView
}];
[operation setShouldExecuteAsBackgroundTaskWithExpirationHandler:^{
// What I have to do here?
}];
[operation start];
[operation waitUntilFinished];
-(void)applicationWillResignActive:(UIApplication *)application{
// What I have to do here?
}
आपकी सहायता के लिए धन्यवाद।
क्या कोई गैर एआरसी विकल्प है? – Tudorizer
क्या आप जानते हैं कि यह यूआरएल रीडायरेक्शन के साथ काम करता है? मैंने यूआरएल को निर्धारित किया है जो फिर डाउनलोड करने के लिए वास्तविक फ़ाइल पर रीडायरेक्ट करता है। इन यूआरएल का उपयोग करके डाउनलोड फिर से शुरू नहीं हो रहे हैं। –
बस यह सुनिश्चित करें कि आप हर बार एक ही लक्ष्यपैथ निर्दिष्ट करते हैं। इसके अलावा यह निर्देशिका नहीं हो सकता है; यदि आप एक निर्देशिका निर्दिष्ट करते हैं, तो यह फ़ाइल का नाम देने के लिए यूआरएल का उपयोग करेगा। – mrgrieves