Home  >  Article  >  Backend Development  >  nginx - ios error when accessing local php interface

nginx - ios error when accessing local php interface

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

(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.}

There is no problem with Android. The packet capture shows my local database closing error

No problem uploading to server nginx. My local one is apache

Reply content:

(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.}

There is no problem with Android. The packet capture shows my local database closing error

No problem uploading to server nginx. My local one is apache

The same interface has no problem accessing Android, but there is a problem with iOS. It should be a problem with parsing JSON on iOS

What is the content-type returned by the interface

You have specified the receiving type as json text, so saving the information will definitely be considered wrong data

Are you using AF to make requests? Try adding the following statement,

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

It is estimated that the data obtained is incorrect

iOS has strict requirements on data format and return information, please check these two data carefully

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