ios - AeroGear - value of type Http has no member 'POST' -




i'm following tutorial oauth 2 authentication, , it's little bit old changes may have been made files uses. trying make http post request using aerogear module. here's how function looks like:

@ibaction func share(_ sender: anyobject) {     // todo: turn code it!     let googleconfig = googleconfig(         clientid: "removed",                               // [1] define google configuration         scopes:["https://www.googleapis.com/auth/drive"])                // [2] specify scope      let gdmodule = accountmanager.addgoogleaccount(config: googleconfig)     // [3] add accountmanager     self.http.authzmodule = gdmodule                                 // [4] inject authzmodule     // http layer object      let multipartdata = multipartdata(data: self.snapshot(),         // [5] define multi-part         name: "image",         filename: "incognito_photo",         mimetype: "image/jpg")     let multipartarray =  ["file": multipartdata]       self.http.post("https://www.googleapis.com/upload/drive/v2/files",   // [6] upload image         parameters: multipartarray,         completionhandler: {(response, error) in             if (error != nil) {                 self.presentalert("error", message: error!.localizeddescription)             } else {                 self.presentalert("success", message: "successfully uploaded!")             }     })  } 

http initialized earlier on of type http.

however, error: "http has no member post" here http.swift file. . https://github.com/aerogear/aerogear-ios-http/blob/master/aerogearhttp/http.swift

there no post function in http, have use request this:

let http = http(baseurl: "http://yourserver.com") http.request(method: .post, path: "/postendpoint",  parameters: ["key": "value"],                     completionhandler: {(response, error) in      // handle response }) 




wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -