Closed dineshsharmav2 closed 8 years ago
A similar question has already been asked before. Please read this thread.
You can create a FailableObject<T:Mappable, E:Mappable>
where T
is the expected type of the response, and E
is the expected type of the Error.
Hi waqqas-imena, This is done but this was not easy as I thought. Thanks. Dinesh S
My concern is that my request implementation with mapping object is working fine when user enter correct credential, but issue come when user enter incorrect details:
My Request to map the objects:
**Alamofire.request(.POST, urlString, parameters: params, encoding: .JSON, headers: headers).responseObject(keyPath: "data") { (response: Response) in {
}**
Below is the JSON response when user entered incorrect credentials: { "success": "false", "message": "The User name or Password is incorrect.", "data": null }
Error when user enter incorrect details: Error : result : FAILURE: Error Domain=com.alamofire.error Code=-6004 "ObjectMapper failed to serialize response." UserInfo={NSLocalizedFailureReason=ObjectMapper failed to serialize response.}
Please guide and suggest according this implementation.