【问题标题】:TTOpenURL() - Secure Password protected link open ? It's don't workTTOpenURL() - 安全密码保护链接打开?这是行不通的
【发布时间】:2011-03-05 20:50:02
【问题描述】:

我将 TTCatalog 用于我的项目。我使用此代码调用网站:

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

但是带有密码保护链接的网站不起作用。其他链接有效(例如 www.google.com)有效。

它不是一个https协议的网站,只是一个有授权的http。

我希望你能帮助我!

非常感谢 - 来自德国的问候

【问题讨论】:

    标签: iphone objective-c xcode ios4


    【解决方案1】:

    在调用 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];
    

    【讨论】:

    • 嗯,我什么时候会弹出用户名和密码警报?喜欢 Safari 吗?这是什么:领域:@“服务器领域”?
    • 我是如何用 TTTableTextItem 做这个的?我把网站称为:[TTTableTextItem itemWithText:@"Monday" URL:@"http://www.MySecureWebsite.me" accessoryURL:nil],
    猜你喜欢
    • 1970-01-01
    • 2011-04-15
    • 2011-09-20
    • 2013-06-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多