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.修改接收响应类型,设置的过多,导致错误了

 

人已赞赏
iOS文章

解决cocoapods diff: /../Podfile.lock: No such file or directory

2019-10-21 20:58:05

iOS文章

whose view is not in the window hierarchy 解决方法

2019-10-22 15:56:22

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索