是否可以将NSURLSession发送的请求记录到控制台?我在身份验证方面遇到问题,如果无法查看请求,我将无法调试 最佳答案 这些方法将以干净的方式打印HTTP请求和响应:classfunclog(request:URLRequest){leturlString=request.url?.absoluteString??""letcomponents=NSURLComponents(string:urlString)letmethod=request.httpMethod!=nil?"\(request.httpMethod!)":