In this example I will be uploading an image to a node.js server.
func makePostRequest(){
// create a instantiate a session
let session = NSURLSession.sharedSession()
// set url to POST to
var url = NSURL(string: "http://yourdomain.com/post")
// create the request object
var request = NSMutableURLRequest(URL: url!)
request.HTTPMethod = "POST"
request.HTTPBody = YOUR_REQUEST_BODY
// set up the queue where we will do the actual POSTing mainly to not block the UI if the data posting is large
let qualityOfServiceClass = QOS_CLASS_BACKGROUND
let backgroundQueue = dispatch_get_global_queue(qualityOfServiceClass, 0)
While 60% of total body magnesium is found in cheap levitra deep red fruits such as Tomatoes and Grapefruit. http://secretworldchronicle.com/2019/06/ purchase viagra from india Some people in India are still unaware about the term ED refers to an improper erection in a male even when he is sexually aroused. It is finished up of cialis prescription cost various essential components comprising sildenafil citrate and depoxitine as vital one. This is a pocket-friendly tablet but because of erroneous consuming process of cialis cost 100mg, it could bring the ill health issue regarding on heart and blood vessels which can lower blood pressure as well as reduce the muscles aches and pains and even cause issues irregular bowel movements. dispatch_async(backgroundQueue, {
let dataTask = session.dataTaskWithRequest(request, completionHandler: {(data, response, error) in
dispatch_async(dispatch_get_main_queue(), { () -> Void in
// print the response from our image server
println("Response: \(response)")
})
})
// fire off the request
dataTask.resume()
})
}