ios - Twitter API invalid URLRequestWithMethod using Swift -


i'm trying access home_timeline request per this example.

however, keep getting following error:

'urlrequestwithmethod' argument list of type '(string, url: string, parameters: nsarray, error: inout nserror?)'

func gethometimeline(){     var clienterror:nserror?     let params = []      let request = twitter.sharedinstance().apiclient.urlrequestwithmethod(         "get",         url: "https://api.twitter.com/1.1/statuses/home_timeline.json",         parameters: params,         error: &clienterror)      if request != nil {         twitter.sharedinstance().apiclient.sendtwitterrequest(request) {                 (response, data, connectionerror) -> void in                 if (connectionerror == nil) {                     var jsonerror : nserror?                     let json : anyobject? =                     nsjsonserialization.jsonobjectwithdata(data,                         options: nil,                         error: &jsonerror)                 }                 else {                     println("error: \(connectionerror)")                 }         }     }     else {         println("error: \(clienterror)")     }  } 

thanks in advance.

define params dictionary , use it.

let params: dictionary = dictionary()

func gethometimeline() {     var clienterror:nserror?     let params: dictionary = dictionary<string, string>()      let request: nsurlrequest! = twitter.sharedinstance().apiclient.urlrequestwithmethod(         "get",         url: "https://api.twitter.com/1.1/statuses/home_timeline.json",         parameters: params,         error: &clienterror)      if request != nil {         twitter.sharedinstance().apiclient.sendtwitterrequest(request!) {             (response, data, connectionerror) -> void in             if (connectionerror == nil) {                 var jsonerror : nserror?                 let json : anyobject? =                 nsjsonserialization.jsonobjectwithdata(data!,                     options: nil,                     error: &jsonerror)                  // check json data                 if (json != nil) {                     println("response = \(json)")                 } else {                     println("error loading json data = \(jsonerror)")                 }             }             else {                 println("error: \(connectionerror)")             }         }     }     else {         println("error: \(clienterror)")     } } 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -