【发布时间】:2016-10-18 04:23:30
【问题描述】:
我在 Swift 3.0 中使用过 Alamofire 4.0,但遇到以下代码问题
类型“方法”(又名“OpaquePointer”)没有成员“GET”
类型“方法”(又名“OpaquePointer”)没有成员“PUT”
类型“方法”(又名“OpaquePointer”)没有成员“POST”
类型“方法”(又名“OpaquePointer”)没有成员“补丁”
类型“方法”(又名“OpaquePointer”)没有成员“删除”
枚举定义:
enum Method {
case get
case put
case post
case patch
case delete
func toAFMethod() -> Alamofire.Method {
switch self {
case .get:
return Alamofire.Method.GET
case .put:
return Alamofire.Method.PUT
case .post:
return Alamofire.Method.POST
case .patch:
return Alamofire.Method.PATCH
case .delete:
return Alamofire.Method.DELETE
}
}
}
【问题讨论】:
-
试试
Alamofire.HTTPMethod.get等——HTTPMethod和小写动词github.com/Alamofire/Alamofire#http-methods。 -
...这些现在是
.get、.put等,小写。
标签: ios swift swift3 alamofire