Forked from anonymous/secretsOfSwiftPostRequests
Last active
August 29, 2015 14:06
-
-
Save nickysemenza/4c039f15745ad0a8ebf9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Playground - noun: a place where people can play | |
import UIKit | |
var str = "Hello, playground" | |
import XCPlayground | |
XCPSetExecutionShouldContinueIndefinitely(continueIndefinitely: true) | |
let url = NSURL(string: "http://yo.ngrok.com/test") | |
let urlRequest = NSURLRequest(URL: url) | |
let postData = NSData() | |
let uploadDataTask = NSURLSession.sharedSession().uploadTaskWithRequest(urlRequest, fromData: postData) { data, response, error in | |
// handle response data, response, and error | |
let json = NSJSONSerialization.JSONObjectWithData(data, options: nil, error: nil) // actually handle error | |
} | |
uploadDataTask.resume() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment