Heim  >  Artikel  >  Backend-Entwicklung  >  nginx - ios 访问本地php接口报错

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

WBOY
WBOYOriginal
2016-07-06 13:51:27875Durchsuche

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

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn