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

  • 相关阅读:
    Eclipse版本
    关于软件版本的说明
    JDK
    java2的三个版本
    vue 自定义下拉选择table组件
    网络图片转base64
    关于重力加速计文章
    整理 node-sass 安装失败的原因及解决办法
    kurentoClient
    es2020
  • 原文地址:https://www.cnblogs.com/tianshifu/p/6361804.html
Copyright © 2011-2022 走看看