你的位置:首页 > 软件开发 > 操作系统 > AFNetworking 简单应用

AFNetworking 简单应用

发布时间:2015-11-06 00:00:34
最近最学习 AFNetworking ,根据自己所学对 AFNetWorking 一些简单应用做了一下简单封装,主要有 get,post形式获取 1 // 2 // AFNetWorking_Demo.h 3 // AFNetWorking_Demo 4 // 5 // Cre ...

最近最学习 AFNetworking ,根据自己所学对 AFNetWorking 一些简单应用做了一下简单封装,主要有 get,post形式获取

AFNetworking 简单应用AFNetworking 简单应用
 1 // 2 // AFNetWorking_Demo.h 3 // AFNetWorking_Demo 4 // 5 // Created by Ager on 15/11/4. 6 // Copyright © 2015年 Ager. All rights reserved. 7 // 8  9 #import <Foundation/Foundation.h>10 11 @interface AFNetWorking_Demo : NSObject12 13 14 /**15  * get 方法请求 16  * block success 参数类型 NS17 */18 + (void)requestvoid(^)(id void(^)(id error))fail;19 20 /**21  * post 方法请求 22  * block success 参数类型 NS23 */24 + (void)requestvoid(^)(id void(^)(id error))fail;25 26 /**27  * get 方法请求 JSON28  * block success 参数类型为解析好的 JSON 数据 , 字典或数组29 */30 + (void)requestJSON_GET:(NSString*)strUrl success:(void(^)(id json))success fail:(void(^)(id error))fail;31 32 /**33 * post 方法请求 JSON34 * block success 参数类型为解析好的 JSON 数据 , 字典或数组 35 */36 + (void)requestJSON_POST:(NSString*)strUrl parameters:(NSDictionary*)parameters success:(void(^)(id json))success fail:(void(^)(id error))fail;37 38 39 /**40  * get 方法请求 img41 */42 + (void)requestIMG_GET:(NSString*)strUrl success:(void(^)(id image))success fail:(void(^)(id error))fail;43 44 /**45  * 下载文件46  *47  * @param urlStr 要下载文件的路径48 */49 + (void)sessionDownloadWithUrl:(NSString *)urlStr success:(void (^)(NSURL *fileURL))success fail:(void (^)())fail;50 51 /**52  * 上传文件53  *54  * @param urlStr  上传网址地址55  * @param filePath 要上传的文件沙盒路径56 */57 + (void)upLoad:(NSString*)urlStr filePath:(NSString *)filePath success:(void(^)(id responseObject))success fail:(void(^)())fail;58 59 @end

原标题:AFNetworking 简单应用

关键词:net

net
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。