AF解析Json出错的时候 这样看提示信息
2015-06-30 19:06
585 查看
AF解析json出错:
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=0x8a8a700 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}
可打印 NSLog ( @"operation: %@" , operation. responseString ); 服务端返回的结果看看哪里错了
[client getPath : nil parameters : nil success :^( AFHTTPRequestOperation *operation, id responseObject)
{
NSError *error;
NSDictionary *dict = [ NSJSONSerialization JSONObjectWithData :responseObject options : NSJSONReadingMutableLeaves error :&error];
NSLog ( @"operation: %@" , operation. responseString );
if (success) {
success(dict);
}
}
failure :^( AFHTTPRequestOperation *operation, NSError *error)
{
NSLog ( @"error description:%@" ,[error description ]);
}];
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=0x8a8a700 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}
可打印 NSLog ( @"operation: %@" , operation. responseString ); 服务端返回的结果看看哪里错了
[client getPath : nil parameters : nil success :^( AFHTTPRequestOperation *operation, id responseObject)
{
NSError *error;
NSDictionary *dict = [ NSJSONSerialization JSONObjectWithData :responseObject options : NSJSONReadingMutableLeaves error :&error];
NSLog ( @"operation: %@" , operation. responseString );
if (success) {
success(dict);
}
}
failure :^( AFHTTPRequestOperation *operation, NSError *error)
{
NSLog ( @"error description:%@" ,[error description ]);
}];
相关文章推荐
- jstree使用小结(二)
- Javascript 严格模式详解
- JSP基本语法
- JSON学习
- JSON学习
- JSON学习
- JSP的运行原理及本质
- JavaScript标准Selection操作
- Js jq获取select值
- Javascript调用MsRdpClient 完成Web调用远程桌面(CSDN手动迁移)
- js常用事件列表
- 利用Angular JS 给页面赋值
- js读取json,纠结。。。
- jstree使用小结(一)
- JSONArray构造方法在不同API上的区别
- JavaScript权威指南_115_第15章_脚本化文档_15.2-选取文档元素-通过标签名选取元素
- JavaScript权威指南_114_第15章_脚本化文档_15.2-选取文档元素-通过name选取元素
- js 字符串转换成数字的三种方法
- js中substring和substr的用法
- JavaScript