小编Lov*_*wat的帖子

Alamofire 4.0与Swift 3的"没有成员"错误

我在使用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)

ios swift alamofire swift3

5
推荐指数
1
解决办法
2838
查看次数

标签 统计

alamofire ×1

ios ×1

swift ×1

swift3 ×1