2015-10-05 69 views
0

xcode 7 swift,我爲我的webview使用https,應用程序加載頁面成功,但它說"2015-10-05 18:03:51.204 HKCateringApp[1326:45336] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9824)" 請幫忙解決它。在這裏我的代碼:xcode 7 swift webview https輸出報告

let URL = NSURL(string: "https://www.ssls.com") 

    WebView.loadRequest(NSURLRequest(URL: URL!)) 
+2

的可能的複製[CFNetwork的SSLHandshake失敗的iOS 9](http://stackoverflow.com/questions/30720813/cfnetwork-sslhandshake-failed-ios-9) – Moritz

+0

你檢查AppTransport安全性在info.plist中? –

回答

1

你要只是NSAllowsArbitraryLoads關鍵在你Info.plist文件添加到是在NSAppTransportSecurity字典。 iOS 9.0中的新東西,所以你必須這樣做。

例如,

<key>NSAppTransportSecurity</key> 
<dict> 
     <key>NSAllowsArbitraryLoads</key> 
    <true/> 
</dict> 
+0

你能指導我怎麼做嗎?我是新來的使用Xcode和無法找到NSAppTransportSecurity – GPH

+0

請參閱本教程 - > http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/|| http://i.stack.imgur.com/CnBlN.png –

+0

你不會找到關鍵的NSAppTransportSecurity。您必須手動粘貼並輸入,並將其值保存爲YES。那就是它。 –