2011-03-05 50 views
0

我使用TTCatalog作为我的项目。我把一个网站,这个代码:TTOpenURL() - 安全密码保护链接是否打开?这是行不通的

TTOpenURL(@"http://www.MySecureWebsite.me"); 

但随着密码保护的网站链接的不工作。其他链接作品(例如www.google.com)的作品。

这不是一个使用https协议的网站,只有一个具有授权的http。

我希望你能帮助我!

非常感谢 - 来自德国

回答

0

问候你有没有尝试调用TTOpenURL之前调用NSURLCredentialStorage &朋友?您可以设置不同的持久化模式(无,会话,永久=钥匙圈),等等,等等

NSURLCredential *credential = [NSURLCredential credentialWithUser:@"username" password:@"password" persistence:NSURLCredentialPersistencePermanent]; 

NSURLProtectionSpace *protectionSpace = [[NSURLProtectionSpace alloc] initWithHost:@"www.MySecureWebsite.me" port:80 protocol:@"http" realm:@"server's realm" authenticationMethod:NSURLAuthenticationMethodHTTPBasic]; 

[[NSURLCredentialStorage sharedCredentialStorage] setDefaultCredential:credential forProtectionSpace:protectionSpace]; 

[protectionSpace release]; 
+0

嗯,当我会弹出一个警告的用户名和密码?像Safari一样? Whats This:realm:@“server's realm”? – user3187598 2011-03-05 21:24:28

+0

而我如何使TTTableTextItem与此?在那里,我拨打网站这样:'[TTTableTextItem itemWithText:@ “星期一” 网址:@ “http://www.MySecureWebsite.me” \t \t \t \t \t \t \t \t \t \t \t accessoryURL:无],' – user3187598 2011-03-05 21:29:02