美文网首页
AFNetworking报错3840

AFNetworking报错3840

作者: ioido | 来源:发表于2017-05-31 16:06 被阅读0次

    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);
        }
    

    相关文章

      网友评论

          本文标题:AFNetworking报错3840

          本文链接:https://www.haomeiwen.com/subject/gikjfxtx.html