Cancels the task.
- iOS 7.0+
- macOS 10.9+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
This method returns immediately, marking the task as being canceled. Once a task is marked as being canceled,
url will be sent to the task delegate, passing an error in the domain
NSURLError with the code
NSURLError. A task may, under some circumstances, send messages to its delegate before the cancelation is acknowledged.
This method may be called on a task that is suspended.