AFNetworking最新版本包含以下幾部分:

第一部分:AFSecurityPolicy.m
AFN提供的三種安全策略:
typedef NS_ENUM(NSUInteger, AFSSLPinningMode) {
? ? AFSSLPinningModeNone,//無(wú)校驗(yàn)
? ? AFSSLPinningModePublicKey,//公鑰校驗(yàn)
? ? AFSSLPinningModeCertificate,//證書(shū)校驗(yàn)
};
三個(gè)類方法初始化安全策略:
//默認(rèn)的安全策略,不允許無(wú)效的證書(shū),需要驗(yàn)證域名,不會(huì)對(duì)固定的證書(shū)和公鑰做校驗(yàn);
+ (instancetype)defaultPolicy;
//創(chuàng)建并返回一個(gè)指定安全模式的策略;
+ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode;
//創(chuàng)建并返回一個(gè)指定安全模式并綁定證書(shū)的安全策略。
+ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode withPinnedCertificates:(NSSet <NSData *> *)pinnedCertificates;
第二部分:AFNetworkReachabilityManager.m
AFN提供的四種網(wǎng)絡(luò)狀態(tài):
typedef NS_ENUM(NSInteger, AFNetworkReachabilityStatus) {
? ? AFNetworkReachabilityStatusUnknown? ? ? ? ? = -1,//未知網(wǎng)絡(luò)
? ? AFNetworkReachabilityStatusNotReachable? ? = 0,//沒(méi)網(wǎng)絡(luò)
? ? AFNetworkReachabilityStatusReachableViaWWAN = 1,//蜂窩網(wǎng)絡(luò)
? ? AFNetworkReachabilityStatusReachableViaWiFi = 2,//wifi
};
五種初始化方式:
//返回有默認(rèn)套接字地址的網(wǎng)絡(luò)管理器單例;
+ (instancetype)sharedManager;
//返回有默認(rèn)套接字地址的網(wǎng)絡(luò)管理器;
+ (instancetype)manager;
//返回有指定域的網(wǎng)絡(luò)管理器;
+ (instancetype)managerForDomain:(NSString *)domain;
//創(chuàng)建并返回具有自定義套接字地址的網(wǎng)絡(luò)管理器
+ (instancetype)managerForAddress:(const void *)address;
//通過(guò)系統(tǒng)的網(wǎng)絡(luò)檢測(cè)對(duì)象初始化網(wǎng)絡(luò)管理器
+ (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability NS_DESIGNATED_INITIALIZER;
網(wǎng)絡(luò)狀態(tài)改變時(shí),block回調(diào):
- (void)setReachabilityStatusChangeBlock:(nullable void (^)(AFNetworkReachabilityStatus status))block;
第三部分:AFURLRequestSerialization.m
暫定一種HTTP請(qǐng)求序列化類型:
typedef NS_ENUM(NSUInteger, AFHTTPRequestQueryStringSerializationStyle) {
? ? AFHTTPRequestQueryStringDefaultStyle = 0,
};
AFURLRequestSerialization協(xié)議:返回一個(gè)帶指定參數(shù)的序列化請(qǐng)求。
AFHTTPRequestSerializer類(遵守AFURLRequestSerialization協(xié)議):
對(duì)序列化參數(shù)進(jìn)行編碼、是否可以用手機(jī)流量創(chuàng)建網(wǎng)絡(luò)、創(chuàng)建請(qǐng)求的緩存策略、創(chuàng)建cookies處理方式、是否在接收請(qǐng)求響應(yīng)之前繼續(xù)發(fā)送請(qǐng)求、設(shè)置超時(shí)時(shí)間、設(shè)置獲取請(qǐng)求頭信息、設(shè)置清除http auth信息、默認(rèn)和自定義查詢字符串序列化方法。
三種創(chuàng)建并返回可變url請(qǐng)求的方法:
//默認(rèn)方法
- (NSMutableURLRequest *)requestWithMethod:(NSString *)method
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? URLString:(NSString *)URLString
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? parameters:(nullable id)parameters
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? error:(NSError * _Nullable __autoreleasing *)error;
//自定義block方法
- (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)method
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? URLString:(NSString *)URLString
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? parameters:(nullable NSDictionary <NSString *, id> *)parameters
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? error:(NSError * _Nullable __autoreleasing *)error;
//刪除HTTPBodySteam
- (NSMutableURLRequest *)requestWithMultipartFormRequest:(NSURLRequest *)request
? ? ? ? ? ? ? ? ? ? ? ? ? ? writingStreamContentsToFile:(NSURL *)fileURL
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? completionHandler:(nullable void (^)(NSError * _Nullable error))handler;
AFJSONRequestSerializer:專門用來(lái)處理類型為json的請(qǐng)求
AFPropertyListRequestSerializer:專門用來(lái)處理類型為x-plist的請(qǐng)求
第四部分:AFURLResponseSerialization.m
AFURLResponseSerialization協(xié)議:返回一個(gè)帶指定參數(shù)的序列化響應(yīng)協(xié)議
AFHTTPResponseSerializer類:初始化響應(yīng)類、設(shè)置響應(yīng)可接受的狀態(tài)碼、設(shè)置響應(yīng)可接受的Content - Type類型、是否返回有效的響應(yīng)
AFJSONResponseSerializer:檢驗(yàn)和解碼application/json、text/json、text/javascript類型的響應(yīng)
AFXMLParserResponseSerializer:檢驗(yàn)和解碼application/xml、text/xml類型的響應(yīng)
AFXMLDocumentResponseSerializer:檢驗(yàn)和解碼application/xml、text/xml文檔類型的響應(yīng)
AFPropertyListResponseSerializer:檢驗(yàn)和解碼x-plist類型的響應(yīng)
AFImageResponseSerializer:檢驗(yàn)和解碼UIImage和NSImage類型的響應(yīng)
AFCompoundResponseSerializer:檢驗(yàn)和解碼多種潛在類型的響應(yīng)
第五部分:AFURLSessionManager.m
兩種初始化方法:
//根據(jù)配置信息初始化網(wǎng)絡(luò)會(huì)話
- (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration;
//配置信息為nil,初始化網(wǎng)絡(luò)會(huì)話
- (instancetype)init;
取消網(wǎng)絡(luò)操作:
//是否取消任務(wù),使網(wǎng)絡(luò)會(huì)話失效
- (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks;
創(chuàng)建普通網(wǎng)絡(luò)會(huì)話:
//根據(jù)請(qǐng)求信息創(chuàng)建網(wǎng)絡(luò)會(huì)話
- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request
? ? ? ? ? ? ? ? ? ? ? ? ? ? completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject,? NSError * _Nullable error))completionHandler DEPRECATED_ATTRIBUTE;
//根據(jù)請(qǐng)求信息創(chuàng)建可以查詢上傳、下載進(jìn)度的網(wǎng)絡(luò)會(huì)話? ? ? ? ? ? ? ? ? ? ? ? ? ?
- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? uploadProgress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock
? ? ? ? ? ? ? ? ? ? ? ? ? ? downloadProgress:(nullable void (^)(NSProgress *downloadProgress))downloadProgressBlock
? ? ? ? ? ? ? ? ? ? ? ? ? ? completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject,? NSError * _Nullable error))completionHandler;
創(chuàng)建上傳網(wǎng)絡(luò)會(huì)話:
//根據(jù)請(qǐng)求信息和文件url創(chuàng)建可以查詢上傳進(jìn)度的網(wǎng)絡(luò)會(huì)話
- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? fromFile:(NSURL *)fileURL
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError? * _Nullable error))completionHandler;
//根據(jù)請(qǐng)求信息和要上傳的數(shù)據(jù)創(chuàng)建可以查詢上傳進(jìn)度的網(wǎng)絡(luò)會(huì)話? ? ? ? ? ?
- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? fromData:(nullable NSData *)bodyData
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler;
//根據(jù)請(qǐng)求和輸入流創(chuàng)建可以查詢上傳進(jìn)度的網(wǎng)絡(luò)會(huì)話
- (NSURLSessionUploadTask *)uploadTaskWithStreamedRequest:(NSURLRequest *)request
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler;
設(shè)置網(wǎng)絡(luò)請(qǐng)求的回調(diào):
//設(shè)置會(huì)話失效時(shí)回調(diào)的block
- (void)setSessionDidBecomeInvalidBlock:(nullable void (^)(NSURLSession *session, NSError *error))block;
//設(shè)置對(duì)接收到的http auth進(jìn)行校驗(yàn)時(shí),回調(diào)的block。
- (void)setSessionDidReceiveAuthenticationChallengeBlock:(nullable NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * _Nullable __autoreleasing * _Nullable credential))block;
//設(shè)置新的輸入流時(shí),回調(diào)的block。
- (void)setTaskNeedNewBodyStreamBlock:(nullable NSInputStream * (^)(NSURLSession *session, NSURLSessionTask *task))block;
//設(shè)置HTTP重定向時(shí),回調(diào)的block。
- (void)setTaskWillPerformHTTPRedirectionBlock:(nullable NSURLRequest * _Nullable (^)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request))block;
//設(shè)置對(duì)接收到的http auth進(jìn)行校驗(yàn)時(shí),回調(diào)的block。
- (void)setTaskDidReceiveAuthenticationChallengeBlock:(nullable NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, NSURLCredential * _Nullable __autoreleasing * _Nullable credential))block;
//設(shè)置發(fā)送的數(shù)據(jù)時(shí),回調(diào)的block。
- (void)setTaskDidSendBodyDataBlock:(nullable void (^)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend))block;
//完成網(wǎng)絡(luò)任務(wù)時(shí)進(jìn)行設(shè)置
- (void)setTaskDidCompleteBlock:(nullable void (^)(NSURLSession *session, NSURLSessionTask *task, NSError * _Nullable error))block;
//接收到響應(yīng)時(shí),回調(diào)block
- (void)setDataTaskDidReceiveResponseBlock:(nullable NSURLSessionResponseDisposition (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLResponse *response))block;
//當(dāng)下載任務(wù)完成時(shí),設(shè)置網(wǎng)絡(luò)任務(wù)
- (void)setDataTaskDidBecomeDownloadTaskBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLSessionDownloadTask *downloadTask))block;
//當(dāng)數(shù)據(jù)接收到時(shí),設(shè)置網(wǎng)絡(luò)任務(wù)
- (void)setDataTaskDidReceiveDataBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSData *data))block;
//臨時(shí)緩存時(shí)設(shè)置任務(wù)
- (void)setDataTaskWillCacheResponseBlock:(nullable NSCachedURLResponse * (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSCachedURLResponse *proposedResponse))block;
//當(dāng)所有的任務(wù)發(fā)送出去以后,回調(diào)block
- (void)setDidFinishEventsForBackgroundURLSessionBlock:(nullable void (^)(NSURLSession *session))block;
//當(dāng)下載任務(wù)完成時(shí),回調(diào)block
- (void)setDownloadTaskDidFinishDownloadingBlock:(nullable NSURL * _Nullable? (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location))block;
//下載時(shí),寫入數(shù)據(jù)的回調(diào)block
- (void)setDownloadTaskDidWriteDataBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite))block;
//設(shè)置斷點(diǎn)續(xù)傳的block
- (void)setDownloadTaskDidResumeBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t fileOffset, int64_t expectedTotalBytes))block;
第六部分:AFHTTPSessionManager.m
四種初始化方法:
//url和配置信息都是nil
+ (instancetype)manager;
//url和配置信息都是nil
+ (instancetype)init;
//配置信息是nil
- (instancetype)initWithBaseURL:(nullable NSURL *)url;
//url是nil
- (instancetype)initWithBaseURL:(nullable NSURL *)url
? ? ? ? ? sessionConfiguration:(nullable NSURLSessionConfiguration *)configuration;
//url和配置信息都是nil
+ (instancetype)manager;
//url和配置信息都是nil
+ (instancetype)init;
//配置信息是nil
- (instancetype)initWithBaseURL:(nullable NSURL *)url;
//url是nil
- (instancetype)initWithBaseURL:(nullable NSURL *)url
? ? ? ? ? sessionConfiguration:(nullable NSURLSessionConfiguration *)configuration;
網(wǎng)絡(luò)請(qǐng)求方法[Get,Post,Put,Patch,Delete,Head]:
//GET請(qǐng)求
- (nullable NSURLSessionDataTask *)GET:(NSString *)URLString
? ? ? ? ? ? ? ? ? parameters:(nullable id)parameters
? ? ? ? ? ? ? ? ? ? ? success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
? ? ? ? ? ? ? ? ? ? ? failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
//可查詢下載進(jìn)度的GET請(qǐng)求
- (nullable NSURLSessionDataTask *)GET:(NSString *)URLString
? ? ? ? ? ? ? ? ? ? ? ? ? ? parameters:(nullable id)parameters
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgress
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
//HEAD請(qǐng)求
- (nullable NSURLSessionDataTask *)HEAD:(NSString *)URLString
? ? ? ? ? ? ? ? ? ? parameters:(nullable id)parameters
? ? ? ? ? ? ? ? ? ? ? success:(nullable void (^)(NSURLSessionDataTask *task))success
? ? ? ? ? ? ? ? ? ? ? failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
//POST請(qǐng)求
- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
? ? ? ? ? ? ? ? ? ? parameters:(nullable id)parameters
? ? ? ? ? ? ? ? ? ? ? success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
? ? ? ? ? ? ? ? ? ? ? failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;
//可查詢上傳進(jìn)度的POST請(qǐng)求
- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
? ? ? ? ? ? ? ? ? ? ? ? ? ? parameters:(nullable id)parameters
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
//根據(jù)表單類型,構(gòu)建POST網(wǎng)絡(luò)請(qǐng)求
- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
? ? ? ? ? ? ? ? ? ? parameters:(nullable id)parameters
? ? constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block
? ? ? ? ? ? ? ? ? ? ? success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
? ? ? ? ? ? ? ? ? ? ? failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;
//PUT請(qǐng)求
- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
? ? ? ? ? ? ? ? ? ? ? ? ? ? parameters:(nullable id)parameters
? ? ? ? ? ? ? constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;//根據(jù)表單類型,構(gòu)建POST網(wǎng)絡(luò)請(qǐng)求,可查詢上傳進(jìn)度
- (nullable NSURLSessionDataTask *)PUT:(NSString *)URLString
? ? ? ? ? ? ? ? ? parameters:(nullable id)parameters
? ? ? ? ? ? ? ? ? ? ? success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
? ? ? ? ? ? ? ? ? ? ? failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
//PATCH請(qǐng)求
- (nullable NSURLSessionDataTask *)PATCH:(NSString *)URLString
? ? ? ? ? ? ? ? ? ? parameters:(nullable id)parameters
? ? ? ? ? ? ? ? ? ? ? ? success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
? ? ? ? ? ? ? ? ? ? ? ? failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
//DELETE請(qǐng)求
- (nullable NSURLSessionDataTask *)DELETE:(NSString *)URLString
? ? ? ? ? ? ? ? ? ? ? parameters:(nullable id)parameters
? ? ? ? ? ? ? ? ? ? ? ? success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
? ? ? ? ? ? ? ? ? ? ? ? failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
//GET請(qǐng)求
- (nullable NSURLSessionDataTask *)GET:(NSString *)URLString
? ? ? ? ? ? ? ? ? parameters:(nullable id)parameters
? ? ? ? ? ? ? ? ? ? ? success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
? ? ? ? ? ? ? ? ? ? ? failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
//可查詢下載進(jìn)度的GET請(qǐng)求
- (nullable NSURLSessionDataTask *)GET:(NSString *)URLString
? ? ? ? ? ? ? ? ? ? ? ? ? ? parameters:(nullable id)parameters
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgress
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
//HEAD請(qǐng)求
- (nullable NSURLSessionDataTask *)HEAD:(NSString *)URLString
? ? ? ? ? ? ? ? ? ? parameters:(nullable id)parameters
? ? ? ? ? ? ? ? ? ? ? success:(nullable void (^)(NSURLSessionDataTask *task))success
? ? ? ? ? ? ? ? ? ? ? failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
//POST請(qǐng)求
- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
? ? ? ? ? ? ? ? ? ? parameters:(nullable id)parameters
? ? ? ? ? ? ? ? ? ? ? success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
? ? ? ? ? ? ? ? ? ? ? failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;
//可查詢上傳進(jìn)度的POST請(qǐng)求
- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
? ? ? ? ? ? ? ? ? ? ? ? ? ? parameters:(nullable id)parameters
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
//根據(jù)表單類型,構(gòu)建POST網(wǎng)絡(luò)請(qǐng)求
- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
? ? ? ? ? ? ? ? ? ? parameters:(nullable id)parameters
? ? constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block
? ? ? ? ? ? ? ? ? ? ? success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
? ? ? ? ? ? ? ? ? ? ? failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;
//PUT請(qǐng)求
- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
? ? ? ? ? ? ? ? ? ? ? ? ? ? parameters:(nullable id)parameters
? ? ? ? ? ? ? constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;//根據(jù)表單類型,構(gòu)建POST網(wǎng)絡(luò)請(qǐng)求,可查詢上傳進(jìn)度
- (nullable NSURLSessionDataTask *)PUT:(NSString *)URLString
? ? ? ? ? ? ? ? ? parameters:(nullable id)parameters
? ? ? ? ? ? ? ? ? ? ? success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
? ? ? ? ? ? ? ? ? ? ? failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
//PATCH請(qǐng)求
- (nullable NSURLSessionDataTask *)PATCH:(NSString *)URLString
? ? ? ? ? ? ? ? ? ? parameters:(nullable id)parameters
? ? ? ? ? ? ? ? ? ? ? ? success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
? ? ? ? ? ? ? ? ? ? ? ? failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
//DELETE請(qǐng)求
- (nullable NSURLSessionDataTask *)DELETE:(NSString *)URLString
? ? ? ? ? ? ? ? ? ? ? parameters:(nullable id)parameters
? ? ? ? ? ? ? ? ? ? ? ? success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
? ? ? ? ? ? ? ? ? ? ? ? failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;