NSURLcredentialStorage 공식 문서 읽기

3682 단어
NSURLCredentialStorage
Overview
NSURLcredentialStorage는 자격 증명 저장소를 관리하는 단일 예(공유 객체)입니다.
Symbols
Getting the Credential Storage
  • @property(class, readonly, strong) NSURLCredentialStorage *sharedCredentialStorage 공유된 URL 인증서 저장소로 돌아가기;

  • Getting and Setting Default Credentials
  • - (NSURLCredential *)defaultCredentialForProtectionSpace:(NSURLProtectionSpace *)space는 지정된 보호 공간에 대한 기본 자격 증명을 반환합니다.없으면 nil로 돌아가기;
  • - (void)setDefaultCredential:(NSURLCredential *)credential forProtectionSpace:(NSURLProtectionSpace *)space 지정된 보호 공간에 대한 기본 자격 증명을 설정합니다. 지정된 보호 공간에 저장소에 자격 증명이 없으면 이 자격 증명이 추가됩니다.

  • Adding and Removing Credentials
  • - (void)removeCredential:(NSURLCredential *)credential forProtectionSpace:(NSURLProtectionSpace *)space 창고에서 지정한 안전 공간의 지정 인증서를 삭제한다.
  • - (void)removeCredential:(NSURLCredential *)credential forProtectionSpace:(NSURLProtectionSpace *)space options:(NSDictionary *)options 주어진 옵션을 사용하여 창고에서 지정한 안전 공간의 지정한 인증서를 삭제합니다.options: 인증서를 삭제할 때 고려할 옵션을 포함하는 사전입니다.인증서의persistence가 NSURLcredentialPersistenceSynchronizable일 때만 이 옵션을 사용할 수 있습니다.이 정책을 사용하는 NSURLcredential 객체를 삭제하면 자격 증명을 포함하는 모든 디바이스의 자격 증명이 삭제됩니다.
  • - (void)setCredential:(NSURLCredential *)credential forProtectionSpace:(NSURLProtectionSpace *)space에 지정된 안전 공간에 인증서를 추가한다.동일한 사용자 이름의 인증서가 이미 있는 경우 교체
  • Retrieving Credentials
  • @property(readonly, copy) NSDictionary *> *allCredentials 사용 가능한 모든 안전 공간의 인증서;사전에는 NSURLProtectionSpace 대상의 키와 그에 대응하는 값이 있다.값은 사전이며 키는 사용자 이름 문자열이며 값은 해당하는 NSURLcredential 객체입니다.
  • - (NSDictionary *)credentialsForProtectionSpace:(NSURLProtectionSpace *)space 지정된 안전 공간의 모든 인증서로 구성된 사전을 되돌려줍니다.

  • Constants
  • NSString *const NSURLCredentialStorageRemoveSynchronizableCredentials에 해당하는 값은 NSNumber 대상으로 부울 값을 표시하고 NSURLcredentialPersistenceSynchronizable 속성을 포함하는 증빙서류를 삭제해야 하는지를 지시한다.키가 누락되었거나 값이 @NO인 경우 자격 증명을 삭제하려고 하지 않습니다.

  • Notifications
  • const NSNotificationName NSURLCredentialStorageChangedNotification 저장된 자격 증명이 변경되면 이 알림을 보냅니다.알림 대상은 NSURLcredentialStorage 인스턴스입니다.이 알림은 사용자 정보 사전을 포함하지 않습니다.

  • Instance Methods
    이 부분의 방법은 NSURLSessionTaskAdditions 분류 총에 정의되어 있으며 애플 문서에는 설명이 없고 아래는 모두 자신의 YY이다
  • - (void)getCredentialsForProtectionSpace:(NSURLProtectionSpace *)protectionSpace task:(NSURLSessionTask *)task completionHandler:(void (^)(NSDictionary *credentials))completionHandler는 지정된 안전 공간을 얻고 작업의 모든 인증서를 지정하며 얻은 후에completionHandler를 호출한다.
  • - (void)getDefaultCredentialForProtectionSpace:(NSURLProtectionSpace *)space task:(NSURLSessionTask *)task completionHandler:(void (^)(NSURLCredential *credential))completionHandler는 지정된 안전 공간을 얻고 작업의 기본 인증서를 지정하며 얻은 후에completionHandler를 호출합니다.
  • - (void)removeCredential:(NSURLCredential *)credential forProtectionSpace:(NSURLProtectionSpace *)protectionSpace options:(NSDictionary *)options task:(NSURLSessionTask *)task 지정된 옵션에 따라 지정된 공간을 제거하고 지정한 작업의 지정 인증서
  • - (void)setCredential:(NSURLCredential *)credential forProtectionSpace:(NSURLProtectionSpace *)protectionSpace task:(NSURLSessionTask *)task에 지정된 공간을 주고 지정된 작업에 지정한 인증서를 추가합니다.
  • - (void)setDefaultCredential:(NSURLCredential *)credential forProtectionSpace:(NSURLProtectionSpace *)protectionSpace task:(NSURLSessionTask *)task에 지정된 공간을 주고 지정한 작업에 지정한 기본 인증서를 추가합니다.
  • 좋은 웹페이지 즐겨찾기