码迷,mamicode.com
首页 > 其他好文 > 详细

Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)"

时间:2014-07-22 23:04:13      阅读:400      评论:0      收藏:0      [点我收藏+]

标签:des   style   http   color   strong   io   

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

     }];

服务器返回的错误信息:

operation:          ??????{"Result":"1","name":"full","nick":"bfire","sex":"?¥3","email":"","mobi":"","area":"0401","address":"","like":"","photo":"http://weizhuhai.gotoip55.com/upload/member/photo/0/26.jpg","point":"0","coin":"0"}

可以注意到,Result前有串乱码:??????




Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)",码迷,mamicode.com

Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)"

标签:des   style   http   color   strong   io   

原文地址:http://blog.csdn.net/alincexiaohao/article/details/24771859

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!