得到的溶液從蘋果文獻
NSURLCredential *憑證= [[NSURLCredential的alloc] initWithUser:@ 「名爲myUsername」 密碼:@ 「輸入mypassword」 持久性:NSURLCredentialPersistenceForSession] ;
NSURLProtectionSpace *protectionSpace = [[NSURLProtectionSpace alloc]
initWithProxyHost:@"192.168.110.14" //proxy server
port:8080
type:NSURLProtectionSpaceHTTPProxy
realm:nil
authenticationMethod:NSURLAuthenticationMethodDefault];
[[NSURLCredentialStorage sharedCredentialStorage]
setDefaultCredential: credential
forProtectionSpace: protectionSpace];
[protectionSpace release];
[credential release];