asp.net - 没有得到回应 - 使用 Alamofire - 发布方法 - 在 Postman 中正常工作 - Swift 3.0

标签 asp.net swift api post alamofire

我没有收到来自 API 的响应。

Api 在 Postman 中运行良好。

我正在使用下面的代码

    /* ====   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)
                    }
            }
        }

来自 API 的响应 -

responseSerializationFailed(Alamofire.AFError.ResponseSerializationFailureReason.jsonSerializationFailed(Error Domain=NSCocoaErrorDomain Code=3840 “字符 3 周围的值无效。”UserInfo={NSDebugDescription=字符 3 周围的值无效。}))

后端 - .net

最佳答案

您的回复不是 json 格式。 尝试验证您的响应以查看 json 格式在 https://jsonlint.com 上失败的地方

关于asp.net - 没有得到回应 - 使用 Alamofire - 发布方法 - 在 Postman 中正常工作 - Swift 3.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47512487/

相关文章:

asp.net - 如何隐藏复选框列表中未选中的项目?

c# - LESS 到 CSS 的转换是在客户端还是在服务器端完成的?

c# - 单击 ASHX 图片下载

swift delegate - 何时使用弱引用,为什么 'delegate' 为零?

api - 谷歌翻译API有替代翻译吗?

rest - 如何避免滥用您的 REST API?阻止来自同一客户端 JAX-RS (Dropwizard) 的多个调用

c# - 使用 C# 与 ASPX 网站的 MYSQL 数据库连接

ios - Core蓝牙外设:didDiscoverServices not firing

swift - 如何在 Parse 中识别收件人/发件人用户?

php - 在magento 2 api的 Controller 中使用post方法获取发送的值