swift - Authentication with Uber API using NSURLSession -


I am using NSURLSession to use JSON data. How do I update the following code to validate and pass parameters (server token, latitude and longitude) I have a server token and client ID and a secret ?

  urlPath = "Enter" https://api.uber.com/v1/products "let url = NSURL (string: urlPath) go session = NSURLSession.sharedSession () function = session. DataTaskWithURL (URL, completionHandler go: {data, response, error -> if (not valid for error = zero) {println (error)} else {know jsonResult = NSJSONSerialization.JSONObjectWithData (data, options: NSJSONReadingOptions.MutableContainers , Error: zero) as NSDictionary println (jsonResult)}}) task.resume ()  

On, you need to include the token as an HTTP header According to the documentation.

  NSMutableURLRequest * request = // Set up the rest of the request [request set value: [@ "token" stringbapping string:  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -