iOS Developer Library — Pre-Release

Developer

Foundation Framework Reference NSURLCredentialStorage Class Reference

Options
Deployment Target:

On This Page
Language:

NSURLCredentialStorage

NSURLCredentialStorage implements a singleton (shared object) that manages the credential storage.

Inheritance


Conforms To


Import Statement


Swift

import Foundation

Objective-C

@import Foundation;

Availability


Available in iOS 2.0 and later.
  • Returns the shared URL credential storage object.

    Declaration

    Swift

    class func sharedCredentialStorage() -> NSURLCredentialStorage

    Objective-C

    + (NSURLCredentialStorage *)sharedCredentialStorage

    Return Value

    The shared NSURLCredentialStorage object.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in iOS 2.0 and later.

  • The credentials for all available protection spaces. (read-only)

    Declaration

    Swift

    var allCredentials: [NSObject : AnyObject] { get }

    Objective-C

    @property(readonly, copy) NSDictionary *allCredentials

    Discussion

    The dictionary has keys corresponding to the NSURLProtectionSpace objects. The values for the NSURLProtectionSpace keys are dictionaries where the keys are user name strings, and the value is the corresponding NSURLCredential object.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in iOS 2.0 and later.

  • Returns a dictionary containing the credentials for the specified protection space.

    Declaration

    Swift

    func credentialsForProtectionSpace(_ protectionSpace: NSURLProtectionSpace) -> [NSObject : AnyObject]?

    Objective-C

    - (NSDictionary *)credentialsForProtectionSpace:(NSURLProtectionSpace *)protectionSpace

    Parameters

    protectionSpace

    The protection space whose credentials you want to retrieve.

    Return Value

    A dictionary containing the credentials for protectionSpace. The dictionary’s keys are user name strings, and the value is the corresponding NSURLCredential.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in iOS 2.0 and later.

  • Key used by the options dictionary passed in removeCredential:forProtectionSpace:options:.

    Declaration

    Swift

    let NSURLCredentialStorageRemoveSynchronizableCredentials: String

    Objective-C

    NSString *const NSURLCredentialStorageRemoveSynchronizableCredentials;

    Constants

    • NSURLCredentialStorageRemoveSynchronizableCredentials

      NSURLCredentialStorageRemoveSynchronizableCredentials

      The corresponding value is an NSNumber object representing a Boolean value that indicates whether credentials which contain the NSURLCredentialPersistenceSynchronizable attribute should be removed.

      If the key is missing or the value is @NO, then no attempt will be made to remove such a credential.

      Available in iOS 7.0 and later.