错误域= kCFErrorDomainCF网络代码= -1001

时间:2019-01-07 21:17:27

标签: ios swift alamofire

我有以下代码:

        let parameters: [String: String] = [
        "make" : "",
        "style" : "3"
    ]

    if let storedToken = UserDefaults.standard.string(forKey: Constants.userDefaults.kToken) {
        Alamofire.request(Constants.Endpoints.kGetVehicles, method: HTTPMethod.get, parameters: parameters, encoding: JSONEncoding.default, headers: ["Authorization": "JWT \(storedToken)"]).responseJSON { response in

            if let requestResponseJson = response.result.value {

                let requestResponseObject:Dictionary = requestResponseJson as! Dictionary<String, Any>
                print("--------------------------")
                if let vehicleid:String = requestResponseObject["vehicleid"] as? String {


                } else {
                    self.view.hideToastActivity()
                    var style = ToastStyle()
                    style.messageColor = Constants.Colors.classyGreen
                    style.messageAlignment = .center
                    ToastManager.shared.style = style
                    self.view.makeToast("Something bad happened",  duration: 3.0, position: .center, style: style) // now uses the shared style
                    ToastManager.shared.isTapToDismissEnabled = true

                }
            }
        }
    }

从viewDidLoad()调用

但是请求超时并显示以下错误

Error Domain=kCFErrorDomainCFNetwork Code=-1001

0 个答案:

没有答案