在AFNetworking 請(qǐng)求數(shù)據(jù)失敗的block里面 復(fù)制一下代碼 就可以看到服務(wù)器返回的錯(cuò)誤提示信息
NSData * data = error.userInfo[@"com.alamofire.serialization.response.error.data"];
NSString * str = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
NSData *data1 = [str dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *errorDic = [NSJSONSerialization JSONObjectWithData:data1 options:0 error:nil];
NSLog(@"服務(wù)器的錯(cuò)誤原因:%@",errorDic);
[SVProgressHUD showInfoWithStatus:errorDic[@"error"][@"message"]];