File tree 1 file changed +12
-1
lines changed
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -128,12 +128,22 @@ - (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTas
128
128
NSLog (@" RNFS download: unable to move tempfile to destination. %@ , %@ " , error, error.userInfo );
129
129
}
130
130
131
+ // When numerous downloads are called the sessions are not always invalidated and cleared by iOS14.
132
+ // This leads to error 28 – no space left on device so we manually flush and invalidate to free up space
133
+ if (session != nil ){
134
+ [session flushWithCompletionHandler: ^{
135
+ [session finishTasksAndInvalidate ];
136
+ }];
137
+ }
138
+
131
139
return _params.completeCallback (_statusCode, _bytesWritten);
132
140
}
133
141
134
142
- (void )URLSession : (NSURLSession *)session task : (NSURLSessionTask *)task didCompleteWithError : (NSError *)error
135
143
{
136
- if (error && error.code != NSURLErrorCancelled) {
144
+ if (error) {
145
+ NSLog (@" RNFS download: didCompleteWithError %@ , %@ " , error, error.userInfo );
146
+ if (error.code != NSURLErrorCancelled) {
137
147
_resumeData = error.userInfo [NSURLSessionDownloadTaskResumeData ];
138
148
if (_resumeData != nil ) {
139
149
if (_params.resumableCallback ) {
@@ -142,6 +152,7 @@ - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didComp
142
152
} else {
143
153
_params.errorCallback (error);
144
154
}
155
+ }
145
156
}
146
157
}
147
158
You can’t perform that action at this time.
0 commit comments