NSURLErrorDomain error -1012

前端 未结 3 1637
予麋鹿
予麋鹿 2020-12-19 02:20

I need to parse a xml file from a password protected URL I tried the following

NSURLCredential *credential = [NSURLCredential credentialWithUser:@\"admin\"           


        
3条回答
  •  情话喂你
    2020-12-19 02:35

    In my case the issue was caused by a firewall/proxy requiring a client certificate for all HTTPS calls. I resolved this issue by providing a NSURLProtocol subclass to handle authentication challenges and provide this certificate.

    [NSURLProtocol registerClass:self];
    
    //implement these methods
    - (void)didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
    
    - (void)resolveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge withCredential:(NSURLCredential *)credential;
    

提交回复
热议问题