I'm using AFNetworking in an iOS app that I'm working on and when profiling it, I noticed that there were several of my custom AFURLSessionManager subclass objects getting leaked. After looking around a bit, I think I may have found the problem.
AFURLSessionManager retains its NSURLSession object, while also setting itself as the NSURLSession's delegate. Because NSURLSession holds a strong reference to its delegate, this can lead to a retain cycle.
If you can confirm that this is an issue, I'd be glad to look into fixing it.
Thanks!
This is known and documented behavior. When you're finished with a session, call invalidateSessionCancelingTasks:. This is not an issue for most apps, which keep a single session for the lifetime of the application.
Where is it best to place the call to invalidateSessionCancelingTasks ?
Most helpful comment
This is known and documented behavior. When you're finished with a session, call
invalidateSessionCancelingTasks:. This is not an issue for most apps, which keep a single session for the lifetime of the application.