123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- //
- // NetworkManager.h
- // LNManager
- //
- // Created by EchoShacolee on 2017/4/6.
- // Copyright © 2017年 lee. All rights reserved.
- //
- #import <Foundation/Foundation.h>
- /**
- * 网络请求类型
- */
- typedef NS_ENUM(NSUInteger,HttpRequestType) {
- /**
- * post请求
- */
- HttpRequestTypePost = 0,
- /**
- * get请求
- */
- HttpRequestTypeGet
- };
- typedef void (^GetDataHandler)(NSDictionary *successDic, NSString *failureStr);
- @interface NetworkManager : NSObject
- //判断网络是否连接(已改为固定返回YES)
- +(BOOL) connectedToNetWork;
- /**
- post/get请求
- @param method 接口名
- @param parameters 请求体
- @param type post = 0,get = 1
- @param handler 结果回调(数据正常返回successDic;数据为空,数据解析失败,请求失败都返回failureStr)
- */
- + (void)requestWithMethod:(NSString *)method
- parameters:(id)parameters
- type:(HttpRequestType)type
- handler:(GetDataHandler)handler;
- //生成带有签名的URL
- + (NSString *)getURLWithDict:(NSDictionary *)dic urlPre:(NSString *)urlP;
- @end
|