Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/96.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios AeroGear—Http类型的值没有成员';邮政';_Ios_Swift_Http_Aerogear - Fatal编程技术网

Ios AeroGear—Http类型的值没有成员';邮政';

Ios AeroGear—Http类型的值没有成员';邮政';,ios,swift,http,aerogear,Ios,Swift,Http,Aerogear,我正在学习OAuth 2身份验证的教程,它有点旧,所以可能对它使用的文件进行了更改。但是我正在尝试使用AeroGear模块发出Http POST请求。下面是我的函数的外观: @IBAction func share(_ sender: AnyObject) { // TODO: your turn to code it! let googleConfig = GoogleConfig( clientId: "removed",

我正在学习OAuth 2身份验证的教程,它有点旧,所以可能对它使用的文件进行了更改。但是我正在尝试使用AeroGear模块发出Http POST请求。下面是我的函数的外观:

@IBAction func share(_ sender: AnyObject) {
    // TODO: your turn to code it!
    let googleConfig = GoogleConfig(
        clientId: "removed",                               // [1] Define a Google configuration
        scopes:["https://www.googleapis.com/auth/drive"])                // [2] Specify scope

    let gdModule = AccountManager.addGoogleAccount(config: googleConfig)     // [3] Add it to AccountManager
    self.http.authzModule = gdModule                                 // [4] Inject the AuthzModule
    // into the 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在早些时候被初始化为http类型

但是,我得到一个错误:“Http没有成员帖子” 这是Http.swift文件。
http中没有
POST
功能,您必须使用如下请求:

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

http中没有
POST
函数,您必须使用如下请求:

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

应该是
.upload
吗?@Tj3n给了我一个问题“对成员上传的引用不明确(…)”应该是
.upload
吗?@Tj3n给了我一个问题“对成员上传的引用不明确(…)”