首页 > 代码库 > AFNetWorking 2.0 使用
AFNetWorking 2.0 使用
1 用法1
/* { dqj = "454545\U5143"; dz = ""; id = 44; jpcs = "0\U6b21\U51fa\U4ef7"; jssj = "2014-11-29 12:48:24"; mc = 454545; qpj = "454545\U5143"; tp = "http://122.225.106.234:8082/ProjectManage/UploadImages/1.png"; zt = "\U8fdb\U884c\U4e2d"; } */ -(void) requestUseAFJSONRequest{ NSURL *postUrl = [Tool generateURL2WithServer:api_server andApi:api_auction_list andEncode:NO]; NSURLRequest *request = [NSURLRequest requestWithURL:postUrl]; AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request]; [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { NSLog(@"Success: %@", operation.responseString); NSString *requestTmp = [NSString stringWithString:operation.responseString]; NSData *resData = [[NSData alloc] initWithData:[requestTmp dataUsingEncoding:NSUTF8StringEncoding]]; //系统自带JSON解析 NSDictionary *resultDic = [NSJSONSerialization JSONObjectWithData:resData options:NSJSONReadingMutableLeaves error:nil]; } failure:^(AFHTTPRequestOperation *operation, NSError *error) { NSLog(@"Failure: %@", error); // [SVProgressHUD dismissWithError:@"提交失败,请重试"]; }]; [operation start]; }
AFNetWorking 2.0 使用
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。