Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [
- {
- "created_at": "Tue Mar 31 13:47:02 +0000 2015",
- "id": 582901921171796000,
- }
- ]
- let urlPath = "http://api.twitter.com/1.1/statuses/home_timeline.json?AUTHENTICATION_INFO"
- let url: NSURL = NSURL(string: urlPath)!
- let session = NSURLSession.sharedSession()
- let task = session.dataTaskWithURL(url, completionHandler: {data, response, error -> Void in
- if error != nil {
- // If there is an error in the web request, print it to the console
- println(error.localizedDescription)
- }
- var err: NSError?
- var jsonResult = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: &err) as NSDictionary
- if err != nil {
- // If there is an error parsing JSON, print it to the console
- println("JSON Error (err!.localizedDescription)")
- }
- let json = JSON(jsonResult)
- let createdAt = json[0]["created_at"].string!
- println(createdAt)
- })
- task.resume()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement