首页  >  文章  >  后端开发  >  nginx - ios 访问本地php接口报错

nginx - ios 访问本地php接口报错

WBOY
WBOY原创
2016-07-06 13:51:27875浏览

(JSON text did not start with array or object and option to allow fragments not set.) UserInfo=0x175c65b00 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}

安卓没有问题 抓包显示我本地数据库关闭错误

上传服务器nginx 没问题 我本地为apache

回复内容:

(JSON text did not start with array or object and option to allow fragments not set.) UserInfo=0x175c65b00 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}

安卓没有问题 抓包显示我本地数据库关闭错误

上传服务器nginx 没问题 我本地为apache

同一个接口 android访问没有问题 ios有问题 应该是iOS那边解析JSON的问题

接口返回的content-type是什么

你这是指定了接收类型为json文本了 所以保存信息肯定会被认为是错误数据

你是使用AF进行请求吗?添加下面语句试试,

<code>self.manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
</code>

估计获取数据不对

iOS对数据格式跟返回信息要求比较严格,好好查看下这两个数据吧

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn