AFNetworking报错3840
2017-05-31 本文已影响0人
ioido
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);
}