Home  >  Article  >  Backend Development  >  nginx - ios 访问本地php接口报错

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

WBOY
WBOYOriginal
2016-07-06 13:51:27874browse

(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对数据格式跟返回信息要求比较严格,好好查看下这两个数据吧

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn