1
votes

I am not getting response from API.

Api is working fine in Postman.

I am using below code

    /* ====   MARK:  RAGISTER USER - SIMPLE  ==== */
        func registerUser(parameter:[String:AnyObject],completion:@escaping (_ success:Bool, _ dictVerificationDetail: NSDictionary?)->Void){



AFManager.request(GlobalURL.KRegisterUser,method:.post,parameters:parameter,encoding: JSONEncoding()).responseJSON
                {
                    response in switch response.result {
                    case .success(let JSON2):
                        print("Success with JSON: \(JSON2)")
                        dictGlobal = NSDictionary()
                    case .failure(let error):

                        print(response.result)
                        completion(false, nil)
                    }
            }
        }

Response From API -

responseSerializationFailed(Alamofire.AFError.ResponseSerializationFailureReason.jsonSerializationFailed(Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around character 3." UserInfo={NSDebugDescription=Invalid value around character 3.}))

BackEnd - .net

1

1 Answers

0
votes

Your response is not in json format. try to validate Your response to see where json format fails on https://jsonlint.com