some error occur : The operation couldn’t be completed. ObjectMapper failed to serialize response

613 views Asked by At

this is how I call to api

func userLogin(login : Login) {

        let l = login
        print("login values are : \(l)")



        let UrlRequest = Router.userLogin(login).urlRequest
        Alamofire.request(UrlRequest!).responseObject { (response : DataResponse<TheResponse>) in
            switch response.result {
            case .success(let data):
                if (data.status != 200) {
                    print("Error message : \(data.errorMessage)")
                }
                else {
                    print("success")
                }
                break
            case .failure(let Error):
                print("some error occur : \(Error.localizedDescription)")
                break

        }


        }

    }

}

but always goes to error with this some error occur : The operation couldn’t be completed. ObjectMapper failed to serialize response.. I'm using Alamofire with swift 3. How can I overcome this problem. hope your help with this.

1

There are 1 answers

0
Pushp On

Your code does not have any problem. The JSON in URL is malformed