判断缓存,
先 memory cache,
再 disk cache (NSFileManager )
/**
* Check if image has already been cached
*
* @param url image url
*
* @return if the image was already cached
*/
- (BOOL)cachedImageExistsForURL:(NSURL *)url;
/**
* Check if image has already been cached on disk only
*
* @param url image url
*
* @return if the image was already cached (disk only)
*/
- (BOOL)diskImageExistsForURL:(NSURL *)url;
CTNetworking 分析
@interface FireSingleAPI : UIViewController
-> 遵守协议
@interface TestAPIManager : CTAPIBaseManager <CTAPIManager>
-> 继承
@interface CTAPIBaseManager : NSObject
单元测试
FireSingleAPI(FireSingleAPIViewController )
~> 由 管理
@interface TestCaseFactory : NSObject
if (testCaseType == TestCaseTypeFireSingleAPI) {
testCase = [[FireSingleAPI alloc] init]; // testCase = [[FireSingleAPIViewController alloc] init];
}
YTKNetworking 分析
YTKNetworkingDemo
@interface UploadImageApi : YTKRequest
@interface RegisterApi : YTKRequest
@interface GetUserInfoApi : YTKRequest
@interface GetImageApi : YTKRequest
~>
@interface YTKRequest : YTKBaseRequest
~>
@interface YTKBaseRequest : NSObject
AFN 分析
为了兼容 iOS 7 和 iOS 8的 NSURLSessionTask implementation
AFURLSessionManager.m 文件中
方法混淆
@interface _AFURLSessionTaskSwizzling : NSObject
@end
@implementation _AFURLSessionTaskSwizzling
+ (void)load {
why excute self.session getTasksWithCompletionHandler in initWithSessionConfiguration? #3499
AFURLSessionManager
I believe this for restoring a session from the background.
网友评论