首頁  >  文章  >  後端開發  >  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