我在从 Iphone 应用程序登录网站时遇到问题。它是一个 https,因此是一个 SSL 安全站点。不幸的是,我在尝试登录时收到一条错误消息。而且我不知道如何解决此错误。
这里是错误信息:
2012-08-20 13:38:56.490 Login_2[330:f803] IN GETFILELIST: (null)
2012-08-20 13:38:56.903 Login_2[330:f803] ERROR: (null)
2012-08-20 13:38:56.914 Login_2[330:f803] ERROR!:
Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo=0x6ab9ac0 {NSErrorFailingURLStringKey=https://www.remote.sokratherm.de:80/?content=tableau&tableau=1, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, NSErrorFailingURLKey=https://www.remote.sokratherm.de:80/?content=tableau&tableau=1, NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., NSUnderlyingError=0x6abea00 "An SSL error has occurred and a secure connection to the server cannot be made."}
这里是代码:
NSString *apiPath = [NSString stringWithFormat:@"https://%@:%@/", hostServer, hostPort];
httpClient = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:apiPath]];
[httpClient setAuthorizationHeaderWithUsername:hostUser password:hostPass];
NSMutableURLRequest *request = [httpClient requestWithMethod:@"POST" path:@"index.php" parameters:nil];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
如果您需要更多信息,请询问。 我对任何帮助都很满意。
你好。
最佳答案
服务器 www.remote.sokratherm.de
似乎没有在端口 80 上使用 SSL 运行。您是要指定该端口吗?如果不是,请从您的请求 URL 中删除 :80
。
关于iPhone 使用 SSL 登录网站,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12037114/