Invalidates the session, allowing any outstanding tasks to finish.
- iOS 7.0+
- macOS 10.9+
- tvOS 9.0+
- watchOS 2.0+
This method returns immediately without waiting for tasks to finish. Once a session is invalidated, new tasks cannot be created in the session, but existing tasks continue until completion. After the last task finishes and the session makes the last delegate call related to those tasks, the session calls the
url method on its delegate, then breaks references to the delegate and callback objects. After invalidation, session objects cannot be reused.
To cancel all outstanding tasks, call