typedef NS_ENUM(NSUInteger, ZBJResult) {
ZBJData,
ZBJJson,
ZBJXML,
};
typedef NS_ENUM(NSUInteger, ZBJRequestStyle) {
ZBJRequestJSON,
ZBJRequestString,
};
@interface ZBJAFNetworkTool : NSObject
/**
*? Get請求
*
*? @param url? ? ? ? 網(wǎng)絡(luò)請求地址
*? @param body? ? ? 請求體
*? @param result? ? 返回的數(shù)據(jù)類型
*? @param headerFile 請求頭
*? @param success? ? 網(wǎng)絡(luò)請求成功回調(diào)
*? @param failure? ? 網(wǎng)絡(luò)請求失敗回調(diào)
*/
+ (void)getUrl:(NSString *)url
body:(id)body
result:(ZBJResult)result
headerFile:(NSDictionary *)headerFile
success:(void (^)(id result))success
failure:(void (^)(NSError *error))failure;
/**
*? Post請求
*
*? @param url? ? ? ? ? 網(wǎng)絡(luò)請求地址
*? @param body? ? ? ? 請求體
*? @param result? ? ? 返回值的數(shù)據(jù)類型
*? @param requestStyle 網(wǎng)絡(luò)請求Body的類型
*? @param headerFile? 網(wǎng)絡(luò)請求頭
*? @param success? ? ? 成功回調(diào)
*? @param failure? ? ? 失敗回調(diào)
*/
+ (void)postUrl:(NSString *)url
body:(id)body
result:(ZBJResult)result
requestStyle:(ZBJRequestStyle)requestStyle
headerFile:(NSDictionary *)headerFile
success:(void (^)(id result))success
failure:(void (^)(NSError *error))failure;