zoukankan      html  css  js  c++  java
  • 优秀的缓存请求库,快速请求接口和图片:WTRequestCenter

    WTRequestCenter

    方便缓存的请求库无需任何import和配置,目前实现了基础需求如果有其他需要请在issue 上提出,谢谢!

    使用方法 Usage

    注意:所有的请求都是缓存的

    GET 请求

    [WTRequestCenter getWithURL:url
    parameters:parameters
    completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
    id obj = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&jsonError];
    NSLog(@"result:%@",obj);
    }

    POST 请求

    [WTRequestCenter postWithURL:url
    parameters:parameters
    completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
    id obj = [NSJSONSerialization http://www.bsck.org/JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&jsonError];
    NSLog(@"result:%@",obj);
    }

    缓存图片

    NSURL *url = [NSURL URLWithString:@"http://www.xxx.com/eqdsa.jpg"];
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectZero];
    [WTRequestCenter getImageWithURL:url imageComplectionHandler:^(UIImage *image) {
    imageView.image = image;
    }];

    取消所有请求

    [WTRequestCenter cancelAllRequest]; 

    Requirement

    Only need iOS 5.0 and later,no more!

    需要

    仅仅需要iOS5 ! 不需要其他任何import和配置

  • 相关阅读:
    Web服务器的Socket通信
    Love story
    Excel初探索 - 2008/3
    One Person Game ZOJ Problem Set 3329
    只有程序员才看得懂的情书
    Collecting Bugs_poj2096
    Scout YYF I_poj3744
    hdu 3336 Count the string
    hdu 1669 Jamie's Contact Groups
    poj 1240
  • 原文地址:https://www.cnblogs.com/tianshifu/p/6361804.html
Copyright © 2011-2022 走看看