Alamofire- 表达式类型不明确,在 responseJSON 中没有更多上下文

问题描述 投票:0回答:0

[error screenshot in code](https://i.stack.imgur.com/YUiCh.png)

Alamofire 框架使用 carthage 更新 xcode 版本是 14.2

func getUserInfo(clientInfo: ClientInfo,
                 accessToken: String,
                 completionHandler: @escaping AuthCompletion) {
    
    var urlRequest: URLRequestConvertible?
    switch clientInfo.loginType {
    case .iam:
        urlRequest = router.requestIAMUserInfo(clientInfo, accessToken)
    case .sso:
        urlRequest = router.requestSSOUserInfo(clientInfo, accessToken)
    }
    
    if urlRequest != nil {
        // Can force unwrap since checking for nil
        Alamofire.request(urlRequest!)
            .responseJSON { response in
                guard let data = response.data else {
                    completionHandler(nil, nil)
                    return
                }
                completionHandler(data as AnyObject, nil)
        }
    }
}
ios swift alamofire
© www.soinside.com 2019 - 2024. All rights reserved.