JSON text did not start with array or object and option to allow fragments not set.

JSON text did not start with array or object and option to allow fragments not set.

AFN使用报错:

Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}

网上查了查资料,AFN返回的数据responseObject默认以JSON的方式处理,如果返回的是个HTML或者其他的就会报错。。解决办法,告诉AFN返回的数据不用JSON处理。代码就一句,如下:

manager.responseSerializer = [AFHTTPResponseSerializer serializer]

你可能感兴趣的:(JSON text did not start with array or object and option to allow fragments not set.)