A
n authentication credential consisting of information specific to the type of credential and the type of persistent storage to use, if any.
SDKs
- iOS 2.0+
- macOS 10.2+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Foundation
Declaration
@interface NSURLCredential : NSObject
Overview
The URL Loading System supports password-based user credentials, certificate-based user credentials, and certificate-based server credentials.
When you create a credential, you can specify it for a single request, persist it temporarily (until your app quits), or persist it permanently. Permanent persistence can be local persistence in the keychain, or synchronized persistence across the user's devices, based on their Apple ID.
Note
Permanent storage of credentials is only available for password-based credentials. TLS credentials are never stored permanently by NSURLCredential
. In general, use for-session persistence for TLS credentials.