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和配置

  • 相关阅读:
    LeetCode59 Spiral Matrix II
    LeetCode58 Length of Last Word
    LeetCode54 Spiral Matrix
    LeetCode63 Unique Paths II
    LeetCode62 Unique Paths
    LeetCode55 Jump Game
    网易2017年校招笔试题 最大的奇约数
    Codeforces Round #119 (Div. 2)
    Codeforces Round #118 (Div. 2)
    2016 MIPT Pre-Finals Workshop Taiwan NTU Contest
  • 原文地址:https://www.cnblogs.com/tianshifu/p/6361804.html
Copyright © 2011-2022 走看看