JSON由于错误而无法序列化: [英] JSON could not be serialized because of error:

查看:1071
本文介绍了JSON由于错误而无法序列化:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Alamofire 4.0,在进行网络通话时,我在应用程序审查期间遇到错误,因此我的应用程序被拒绝了。但是对于我和我的客户来说,它运行良好,我们永远都不会遇到错误

I am using Alamofire 4.0, While making network call I am getting below error during the app review so that my app is getting rejected. But for me and my client it's working fine we are never getting below error


由于错误,JSON无法序列化:
无法读取数据,因为格式不正确。

JSON could not be serialized because of error: The data couldn’t be read because it isn’t in the correct format.

我们还检查了服务调用是否正确没碰到服务器(因此没有得到他们的帮助),请找到代码段

We also checked that the service call is not hitting the server(so not getting any help from their side), Please find the code snippet

manager.request(requestURL, method: .post, parameters: param as? Parameters, encoding: URLEncoding.methodDependent, headers: nil).responseJSON { (responseJson) in

})

通过放置各种类型的参数(例如特殊字符,nil等),我们无法从我们的角度重现错误。但是在应用审查期间,我们遇到此错误。

By putting various types of parameters like special character, nil etc.. we did not able to reproduce the error from our side. But during app review we are getting this error. Please help me!!!

参数:

推荐答案

出现了类似的问题。原来,这是我的PHP脚本接收数据并发送回错误的序列化JSON数据。有一个 echo语句可能已损坏序列化数据。检查服务器端代码,而不是检查错误,而是检查echo语句或应注释掉的其他输出。

Had a similar issue. Turned out, it was my PHP script receiving the data and sending back erroneous serialized JSON data. There was an "echo" statement that might have corrupted the serialized data. Check your server-side code, not for error but for an echo statement or other output that should be commented out.

这篇关于JSON由于错误而无法序列化:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆