0
我製作了一個運行https網站的服務器。我想在Xcode的控制檯上打印出網站的信息。在控制檯打印一個網站的信息
爲了做到這一點,我添加了以下到我的ViewController.m
:
- (void)viewDidLoad
{
[super viewDidLoad];
NSError *error;
NSString *address = [NSString stringWithFormat: @"https://54.169.239.78:3001"];
NSURL *url = [NSURL URLWithString:address];
NSString *theWeb = [NSString stringWithContentsOfURL:url encoding:NSASCIIStringEncoding error:&error];
NSLog(@"%@", theWeb);
}
然而,結果總是(null)
。此外,我得到一個錯誤:
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)
即使我已經允許應用程序傳輸安全性在我的Info.plist
有什麼不對?
記錄'錯誤'並查看問題是什麼。 – rmaddy
請參閱[這些搜索結果](http://stackoverflow.com/search?q=%5Bios%5D+kCFStreamErrorDomainSSL+%22-9813%22)。它可能與您的服務器上的SSL證書有關。 – rmaddy
您正在使用自簽名證書嗎? – CaptJak