'why my JSON response is not coming with updated version of Alamofire pod in Swift

With older version of Alamofire 4.4 pod i was getting response.. but now I have updated Almofire now i am not getting response with same code

code: with this updated version of Almofire code I am not getting JSON response

let actualURL: String
if let queryParameters = queryParameters {
var components = URLComponents(string:URL)!
components.queryItems = queryParameters.map { (key, value) in URLQueryItem(name: key, value: value) }
actualURL = components.url!.absoluteString
 } else {
actualURL = URL
}

var headerParams = [String: String]()

if let headers = headers {
headerParams = headers
}
print(headerParams)
print("Actual URL \(actualURL)")

  AF.request(actualURL, method:method, parameters: bodyParameters,encoding: JSONEncoding.default, headers: headerParams as? HTTPHeaders)
.responseJSON { response in

    switch response.result {
    case .success:

        if let result = response.result as? [String : Any] {
            let JSON = result as? NSDictionary
            print("JSON ttttttt: \(JSON)")

            let wrappedResponse = APIJSONReponse.init(
                data: response.data,
                dict: response.result as! Dictionary<String, AnyObject>?,
                response: response.response,
                error: nil, rpcErrorData: nil)

            DispatchQueue.main.async(execute: {
                completionHandler(wrappedResponse)
            })
        }
    case .failure(let error):
        let error = error
        let wrappedResponse = APIJSONReponse.init(error: error, dataDict: [:])
        completionHandler(wrappedResponse)
        print(error.localizedDescription)
    }
    }

with older version of Almofire i am getting response

   Alamofire.request(actualURL, method:method, parameters: bodyParameters,encoding: JSONEncoding.default, headers: headerParams as? HTTPHeaders)
        .responseJSON { response in
            switch response.result {
            case .success:

                if let result = response.result.value {
                    let JSON = result as! NSDictionary
                    print("JSON: \(JSON)")

                    let wrappedResponse = APIJSONReponse.init(
                        data: response.data,
                        dict: response.result.value as! Dictionary<String, AnyObject>?,
                        response: response.response,
                        error: nil, rpcErrorData: nil)

where am i wrong with updated Almofire, please do guide me



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source