Skip to content

Commit

Permalink
documenting the workaround to uploadTaskWithRequest:fromFile: bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Coeur committed May 12, 2016
1 parent 59d5111 commit 27652fe
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions AFNetworking/AFURLSessionManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,7 @@ - (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request
uploadTask = [self.session uploadTaskWithRequest:request fromFile:fileURL];
});

// uploadTask may be nil on iOS7 because uploadTaskWithRequest:fromFile: may return nil despite being documented as nonnull (https://devforums.apple.com/message/926113#926113)
if (!uploadTask && self.attemptsToRecreateUploadTasksForBackgroundSessions && self.session.configuration.identifier) {
for (NSUInteger attempts = 0; !uploadTask && attempts < AFMaximumNumberOfAttemptsToRecreateBackgroundSessionUploadTask; attempts++) {
uploadTask = [self.session uploadTaskWithRequest:request fromFile:fileURL];
Expand Down

0 comments on commit 27652fe

Please sign in to comment.