Allow unverified ssl certificate in UIWebview

后端 未结 7 1972
北恋
北恋 2020-12-02 07:05

I\'m embedding a website in a UIWebView. During development I have it pointed at localhost. The problem is that whenever it hits a \"https://\" url it doesn\'t load. When I

7条回答
  •  孤街浪徒
    2020-12-02 07:37

    Swift 3/4 version for Nick Lockwood answer.

    This is just for testing/development purposes:

    extension NSURLRequest {
        #if DEBUG
        static func allowsAnyHTTPSCertificate(forHost host: String) -> Bool {
            return true
        }
        #endif
    }
    

提交回复
热议问题