Ho trovato una soluzione, dobbiamo aggiungere le credenziali per portachiavi dell'utente Ecco il mio codice
NSURLCredentialStorage * credentialStorage=[NSURLCredentialStorage sharedCredentialStorage]; //(1)
NSURLCredential * newCredential;
newCredential=[NSURLCredential credentialWithUser:@"myUserName" password:@"myPWD" persistence:NSURLCredentialPersistencePermanent]; //(2)
NSURLProtectionSpace * mySpaceHTTP=[[NSURLProtectionSpace alloc] initWithProxyHost:@"ipProxy" port:port type:NSURLProtectionSpaceHTTPProxy realm:nil authenticationMethod:nil]; //(3)
NSURLProtectionSpace * mySpaceHTTPS=[[NSURLProtectionSpace alloc] initWithProxyHost:@"ipProxy" port:port type:NSURLProtectionSpaceHTTPSProxy realm:nil authenticationMethod:nil]; //(4)
[credentialStorage setCredential:newCredential forProtectionSpace:mySpaceHTTP]; //(5)
[credentialStorage setCredential:newCredential forProtectionSpace:mySpaceHTTPS]; //(6)
Ho recuperato prima lo sharedCredentialStorage (1), quindi ho creato nuova NSURLCredential contenente il mio nome utente, la password e il tipo di persistenza da utilizzare (2). Dopo che ho creato due NSURLProtectionSpace (3) (4): una per HTTPS Connexion, e uno per Connexion HTTP
E, infine, ho aggiunto il NSURLCredential sharedCredentialStorage per questi ProtectionSpaces (5) (6)
Spero che questo codice può aiutare