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

请求数据时报错:

error: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.}

原因:

未指定响应接收类型

解决办法:

  1. 指定响应接收类型
    [AFHTTPSessionManager new].requestSerializer = [AFHTTPRequestSerializer serializer];
    [AFHTTPSessionManager new].responseSerializer = [AFHTTPResponseSerializer serializer];

2.修改接收响应类型,设置的过多,导致错误了

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