您的位置:首页 > Web前端 > JavaScript

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 ]); 
      }];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: