AFNetworking报错3840

Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (JSON text did not start with array or object and option to allow fragments not set.) UserInfo=0x9152780 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}

报错信息如上,加上

manager.requestSerializer = [AFHTTPRequestSerializer serializer];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];

依然没有用,让后台看看他写的方法,
遇到后台这样写有问题

    /**
     * 信息
     */
    @ResponseBody
    @RequestMapping("/info/{id}")
    @RequiresPermissions("wy:fieldappointment:info")
    public R info(@PathVariable("id") Long id){
        WyFieldAppointmentEntity wyFieldAppointment = wyFieldAppointmentService.queryObject(id);
        return R.ok().put("data", wyFieldAppointment);
    }

改成下面下面这样就没有问题

    /**
     * 信息
     */
    @ResponseBody
    @RequestMapping(value="/info",method = RequestMethod.GET)
    public R info(Long id){
        WyFieldAppointmentEntity wyFieldAppointment = wyFieldAppointmentService.queryObject(id);
        return R.ok().put("data", wyFieldAppointment);
    }
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容