Good day to everybody,
I'm working on a singleton that should manage the download of contents through the internet, I know that exist ASIHttp request and that is an excellent lib, but I have my own reasons for not using it. The class works pretty fine except for one thing: I'm trying to deal with the public folder of my MobileMe account without success. I uploaded a file inside it and trying to download using my class. Reading some questions on stackOF and reading docs I came up into that code, but it seems to do not work:- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace
{
    if([protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust])
    {
        NSLog(@"SERVER TRUST AUTH");
        return YES;
    }
    else if([protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodHTTPBasic])
    {
        NSLog(@"HTTP BASIC AUTH");
        return YES;
    }
    NSLog(@"NO AUTH");
    return NO;
}
- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthentica开发者_运维知识库tionChallenge *)challenge
{
    NSLog(@"Authetication");
    if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust])
    {
        NSLog(@"Trust Challange");
        SecTrustResultType trustResultType;
        OSStatus err=SecTrustEvaluate(challenge.protectionSpace.serverTrust, &trustResultType);
        NSLog(@"SecTrustResult %lu %ld",trustResultType,err);
        if (trustResultType == kSecTrustResultProceed || trustResultType == kSecTrustResultConfirm || trustResultType == kSecTrustResultUnspecified) {
            [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];
        }
        else{
            [challenge.sender cancelAuthenticationChallenge:challenge];
        }
       // [challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];
    }
    else if([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodHTTPBasic])
    {
        NSLog(@"HTTP Challenge");
        NSURLCredential *credential = [[NSURLCredential alloc] initWithUser:@"user" password:@"pass" persistence:NSURLCredentialPersistenceForSession];
        [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
        [credential release];
    }
    else{
        [[challenge sender]cancelAuthenticationChallenge:challenge];
    }
}
Now I'm stuck because from the log I can see that the evaluate function return a result of 4 that corresponds to a kSecTrustResultUnspecified but nothing is working even if  I say to the challenge sender to continueWithoutCredentialForAuthenticationChallenge.
The url of the file is : https://public.me.com/XXXX/Objective.zip (link removed)the zip is the ObjectiveZip library that I also implemented in my class.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论