Ios AeroGear—Http类型的值没有成员';邮政';
我正在学习OAuth 2身份验证的教程,它有点旧,所以可能对它使用的文件进行了更改。但是我正在尝试使用AeroGear模块发出Http POST请求。下面是我的函数的外观: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",
@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给了我一个问题“对成员上传的引用不明确(…)”