>  기사  >  백엔드 개발  >  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으로 문의하세요.