我在使用Swift 3.0时使用了Alamofire 4.0,但是遇到了以下代码的问题
类型'方法'(又名'OpaquePointer')没有成员'GET'
类型'方法'(又名'OpaquePointer')没有成员'PUT'
类型'方法'(又名'OpaquePointer')没有成员'POST'
类型'方法'(又名'OpaquePointer')没有成员'PATCH'
类型'方法'(又名'OpaquePointer')没有成员'DELETE'
枚举定义:
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
}
}
}
Run Code Online (Sandbox Code Playgroud)