Jeg har funnet en løsning, må vi legge legitimasjon til brukerens nøkkelring her er min kode
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)
Jeg utvinnes først sharedCredentialStorage (1), så jeg opprettet ny NSURLCredential inneholder mitt brukernavn, passord og type utholdenhet til å bruke (2). Etter at jeg laget to NSURLProtectionSpace (3) (4): ett for HTTPS Connexion, og ett for HTTP Connexion
Og til slutt, jeg lagt NSURLCredential den sharedCredentialStorage for disse ProtectionSpaces (5) (6)
Jeg håper at denne koden kan hjelpe deg