SDWebImage 分析 _ CTNetworking 分析_ YTKNetwork分析__ AFN 分析

判断缓存,
先 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.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容