Alamofire.request("https://www.googleapis.com/youtube/v3/playlists",
method: .get, parameters: ["part": "snippet", "channelId":
"UCMztOaBEOOswwu0wHlchkeA", "key":
"AIzaSyBHzTMlp1FkiIQJxda5UgSunikzfnQWnwQ" ], encoding:
JSONEncoding.default, headers: nil).downloadProgress(queue:
DispatchQueue.global(qos: .utility)) { Progress in
print("progress: \(Progress.fractionCompleted)")
}
.validate { request ,response ,data in
return .success
}
.responseJSON { response in
print(response)
debugPrint(response)
}
当我尝试打印响应时,我收到错误“Domain = kCFErrorDomainCFNetwork Code = 303
答案 0 :(得分:2)
将JSONEncoding.default
更改为URLEncoding.default
这些参数是定义的here查询参数,因此您应该使用URLEncoding
代替JSONEncoding