How do I insert a POST request into a UIWebView

前端 未结 7 1518
故里飘歌
故里飘歌 2021-02-01 08:50

For a GET request I\'ve tried this simple method:

NSString *urlAddress = @"http://example.com/";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLReq         


        
7条回答
  •  死守一世寂寞
    2021-02-01 09:22

    Here is a Swift version of Seva Alekseyev's answer which worked perfectly for me. Thanks for the nice post mate! BTW following code is in Swift 3.1.

    fileprivate func prepareDataAndSubmitForRepayment(parameters paramData: [String: Any]) {
        var stringObj = String()
        stringObj.append("")
        stringObj.append("")
        stringObj.append("
    ") //urlString is your server api string! for object in paramData { //Extracting the parameters for request stringObj.append("") } stringObj.append("
    ") debugPrint(stringObj) webviewToLoadPage?.loadHTMLString(stringObj, baseURL: nil) }

提交回复
热议问题