For swift
The following is an example of a POST call for a web view with content type x-www-form-urlencoded.
let url = NSURL (string: "https://www.google.com") let request = NSMutableURLRequest(URL: url!) request.HTTPMethod = "POST" request.addValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") let post: String = "sourceId=44574fdsf01e-e4da-4e8c-a897-17722d00e1fe&sourceType=abc" let postData: NSData = post.dataUsingEncoding(NSASCIIStringEncoding, allowLossyConversion: true)! request.HTTPBody = postData webView.loadRequest(request)
You need to change postData for other types of content.
2ank3th Feb 17 '16 at 15:47 2016-02-17 15:47
source share