優秀的緩存請求庫,快速請求接口和圖片: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 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和配置
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!