1

I've got a really strange error. I have the following line in code:

NSURLSessionDataTask *task = [self.session dataTaskWithRequest:request];

after execution of which the task is nil! This case is not documented anywhere and I couldn't find any similar cases on the web. The session is not nil.

This happens only when I press home to leave the app, come back and do something that sends a request. iOS Simulator 8.3

frangulyan
  • 3,580
  • 4
  • 36
  • 64

1 Answers1

1

This is the bug in iOS, sometimes it just returns nil. Workaround for this is to keep calling this method for several times, just like AFNetworking does for uploadTaskWithRequest: method.

Sega-Zero
  • 3,034
  • 2
  • 22
  • 46