를 사용하여 오류가 발생합니다. 사용자는 최대 약 5,000 개의 파일로 구성된 항목을 다운로드 할 수 있습니다.많은 작업 (NSURLSessionDownloadTask는) <code>AFHTTPRequestOperation</code>에서 <code>AFNetworking 3</code>에 <code>AFURLSessionManager</code>를 사용하여 <code>NSURLSessionDownloadTas</code> K에 AFNetworking
이 파일들은 주로 PDF와 MP4이며 크기는 10KB에서 1GB입니다. NSURLSession
및 AFURLSessionManager
으로의 이전의 일환으로 앱이 다운로드를 계속할 수있는 백그라운드로 들어갔을 때이 다운로드를 시스템에 전달할 수있어서 기뻤습니다. 그러나 우리가 발생하는 것은 이러한 다운로드
손실 배경 전송 서비스
- 또는
연결 "해당 파일의 오류 메시지와 함께 실패하기 시작할 것입니다 또는 디렉토리 "
사용자가 500 파일, 배경 또는 전경에 응용 프로그램과 함께 발생할 수 있습니다. 이후에 다운로드 할 때마다 우리는 앱을 죽이고 다시 시작할 때까지 이러한 오류 메시지를받습니다.
배경 구성이있는 iOS 및 NSURLSession
의 제한 사항이 있거나 아이디어를 얻으려면 어떤 아이디어가 필요합니까?
NSURLSessionConfiguration *configuration =
[NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:@"com.our.app.identifier.downloads"];
[configuration setHTTPMaximumConnectionsPerHost:5];
AFURLSessionManager *sessionManager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
[sessionManager setCompletionQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0)];
을 그리고 업무는 다음과 같다 :
우리 AFURLSessionManager은 다음과 같습니다
NSURLSessionDownloadTask *downloadTask = [self.sessionManager downloadTaskWithRequest:[self requestForItem:item] progress:nil
destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) {
NSString *filePath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0];
return [NSURL fileURLWithPath:[filePath stringByAppendingPathComponent:@"fileid.ext"]];
} completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
// check for error and notify the ui of completion
}];
저는 새로운 사용자를 위해 훌륭하게 형식화 된 질문이라고 말하고 싶습니다. 내가 너를 더 도울 수 있기를 빌어. –