AFHTTPRequestOperationManager *manager = [@H_404_2@AFHTTPRequestOperationManager @H_404_2@manager@H_404_2@];@H_404_2@
@H_404_2@// 所有的网络请求@H_404_2@,均有@H_404_2@manager发起@H_404_2@
@H_404_2@//@H_404_2@需要注意的是,@H_404_2@默认提交请求的数据是二进制的,@H_404_2@返回格式是JSON@H_404_2@
/*@H_404_2@
AFHTTPRequestSerializer 二进制格式@H_404_2@
AFJSONRequestSerializer JSON
AFPropertyListRequestSerializer PList(是一种特殊的@H_404_2@XML,解析起来相对容易@H_404_2@)
*/
@H_404_2@//responseSerializer 接收数据类型@H_404_2@
manager.@H_404_2@responseSerializer.@H_404_2@acceptableContentTypes = [@H_404_2@NSSet@H_404_2@ @H_404_2@setWithObject@H_404_2@:@H_404_2@@"text/html"@H_404_2@];@H_404_2@
@H_404_2@//如果报接受类型不一致请替换一致@H_404_2@text/html或别的@H_404_2@
@H_404_2@//operation请求的数据?@H_404_2@responseString返回的字符串?@H_404_2@
[manager POST@H_404_2@:GET_POST_INFO_URL@H_404_2@ parameters@H_404_2@:nil@H_404_2@ success@H_404_2@:^(AFHTTPRequestOperation@H_404_2@ *operation,id@H_404_2@ responSEObject) {
NSLog@H_404_2@(@"Success:%@"@H_404_2@,responSEObject);
NSString@H_404_2@* requestString=[NSString@H_404_2@ stringWithString@H_404_2@:operation.responseString@H_404_2@];
@H_404_2@NSData@H_404_2@* data=[[@H_404_2@NSData@H_404_2@ @H_404_2@alloc] @H_404_2@initWithData:[requestString @H_404_2@dataUsingEncoding:@H_404_2@NSUTF8StringEncoding]];@H_404_2@//@H_404_2@返回的字符串转换成@H_404_2@date@H_404_2@
@H_404_2@NSDictionary@H_404_2@* jsonDict=[@H_404_2@NSJSONSerialization@H_404_2@ @H_404_2@JSONObjectWithData:data @H_404_2@options:@H_404_2@NSJSONReadingMutableLeaves @H_404_2@error:@H_404_2@nil@H_404_2@];@H_404_2@//@H_404_2@解析@H_404_2@json@H_404_2@为@H_404_2@nsdictionary@H_404_2@类型@H_404_2@ @H_404_2@数据会放在内存中@H_404_2@
[data release@H_404_2@];
_dataArray@H_404_2@=[jsonDict objectForKey@H_404_2@:@"data"@H_404_2@];
@H_404_2@FangYuanViewController* fangYuan=[[@H_404_2@FangYuanViewController @H_404_2@alloc@H_404_2@] @H_404_2@ initWithNibName@H_404_2@:@H_404_2@@"FangYuanViewController"@H_404_2@ @H_404_2@bundle@H_404_2@:@H_404_2@nil@H_404_2@];@H_404_2@
fangYuan.dataArray@H_404_2@=[[[NSMutableArray@H_404_2@ alloc@H_404_2@] init@H_404_2@] autorelease@H_404_2@];
fangYuan.dataArray@H_404_2@=_dataArray@H_404_2@;
[self@H_404_2@ addChildViewController@H_404_2@:fangYuan];
[self@H_404_2@.view@H_404_2@ addSubview@H_404_2@:fangYuan.view@H_404_2@];
[fangYuan @H_404_2@didMoveToParentViewController:@H_404_2@self@H_404_2@];@H_404_2@
[fangYuan release@H_404_2@];
[ProgressHUD@H_404_2@ showSuccess@H_404_2@:@"@H_404_2@加载成功@H_404_2@"@H_404_2@];
NSLog@H_404_2@(@"@H_404_2@拿到房源数据成功@H_404_2@"@H_404_2@);
} failure@H_404_2@:^(AFHTTPRequestOperation@H_404_2@ *operation,NSError@H_404_2@ *error) {
[ProgressHUD@H_404_2@ showError@H_404_2@:@"@H_404_2@加载失败@H_404_2@,@H_404_2@请检查网路@H_404_2@!"@H_404_2@];
}];
@H_56_403@//@H_404_2@
- (NSData@H_404_2@
}
- (id@H_404_2@)toArrayOrNSDictionary:(NSData@H_404_2@
}
#import@H_404_2@
@implementation@H_404_2@
-(id@H_404_2@)JSONValue;
{
}
@end
@implementation@H_404_2@
-(NSData@H_404_2@*)JSONString;
{
result = [@H_404_2@NSJSONSerialization