accept-sample-ios icon indicating copy to clipboard operation
accept-sample-ios copied to clipboard

memory leak for URLSession

Open Shvier opened this issue 4 years ago • 0 comments

  • Platform: iOS x86 Simulator

  • OS Version: 13.3

  • Issue Detail class HTTP in AcceptSDK does not deallocate after getTokenWithRequest completed Instruments_2020-03-12 16-25-04@2x

    • Steps to Reproduce call getTokenWithRequest

    • Reason In this line, class HTTP has been set as URLSession's delegate, and URLSessionDelegate is a strong reference property, not weak reference

    • Solution After task has finished, making URLSession invalidate will remove the reference to HTTP. session.finishTasksAndInvalidate() Add the above code after semaphore.wait

Shvier avatar Mar 12 '20 08:03 Shvier