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



转载于:https://my.oschina.net/bingshanguxue/blog/360947

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值