- iOS 5.0+
- macOS 10.7+
- tvOS 9.0+
- watchOS 2.0+
NSURLConnection objects should implement either the data or download delegate protocol (including the methods described in this protocol). Specifically:
If you are using
NSURLConnectionin conjunction with Newsstand Kit’s
download(with:)method, the delegate class should implement the
Otherwise, the delegate class should implement the
Delegates that wish to perform custom authentication handling should implement the
connection(_:willSendRequestFor:) method, which is the preferred mechanism for responding to authentication challenges. (See
URLAuthenticationChallenge for more information on authentication challenges.) If
connection(_:willSendRequestFor:) is not implemented, the older, deprecated methods
connection(_:didCancel:) are called instead.
connection(_:didFailWithError:) method is called at most once if an error occurs during the loading of a resource. The
connectionShouldUseCredentialStorage(_:) method is called once, just before the loading of a resource begins.