[
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2017 J_Knight_\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# SJNetwork\n\n![](https://img.shields.io/badge/build-passing-brightgreen.svg)\n![](https://img.shields.io/badge/platform-iOS-lightgrey.svg)\n![](https://img.shields.io/badge/language-Objective--C-30A3FC.svg)\n![](https://img.shields.io/badge/pod-v1.2.0-orange.svg)\n[![](https://img.shields.io/badge/blog-JueJin-007FFF.svg)](https://juejin.im/post/5a3f4ae8f265da4322416967)\n[![](https://img.shields.io/badge/weibo-%40J__Knight__-ff0000.svg)](https://weibo.com/1929625262/profile?rightmod=1&wvr=6&mod=personinfo&is_all=1)\n[![](https://img.shields.io/badge/License-MIT-ff69b4.svg)](https://github.com/knightsj/SJNetwork/blob/master/LICENSE)\n\n## Introduction\n\n\n\nSJNetwork provides a high level network request API  based on AFNetworking and inspired by YTKNetwork: generating network request object according to the configuration of a specific network request(url, method, parameters etc.)  and managing requests by the corresponding objects.\n\nDocument for Chinese-convenient reader:[中文文档](https://juejin.im/post/5a3f4ae8f265da4322416967)\n\n\n## Features\n\n\n\n- **Ordinary request**: sending GET,POST,PUT,DELETE network request.\n  - write and load caches, configure cache available time duration​\n- **Upload request**: sending upload image(s) network request\n  - one and more than one image uploading and configure compress ratio before uploading​\n- **Download request**: sending download file network request\n  - resumable or not\n  - background downloading supporting or not\n- **Default parameters**:default parameters will be added on request body\n- **Custom header**: configuring custom request header(key-value)\n- **Base url configuration**  : server url of network requests\n- **Request management**:canceling one or more than one current network requests; checking current requests' information\n- **Cache operation**: writing, loading or clearing one or more than one cache of network requests ; calculating cache size\n- **Debug mode switch**: for convenience of debugging\n\n\n\n\n\n\n## Usage\n\n\n**Method1:**  using Cocoapods:\n\n``pod 'SJNetwork'``\n\nthen\n\n```objective-c\n#import <SJNetwork/SJNetwork.h>\n```\n\n\n\n**Method2**: moving ``SJNetwork``folder into your project.\n\nthen\n\n```objective-c\n#import \"SJNetwork.h\"\n```\n\n\n\n### Basic Configuration\n\n\n\n#### Server url\n\n```objective-c\n[SJNetworkConfig sharedConfig].baseUrl = @\"http://v.juhe.cn\";\n```\n\n\n\n#### Default parameters\n\n```objective-c\n[SJNetworkConfig sharedConfig].defailtParameters = @{@\"app_version\":[[[NSBundle mainBundle] infoDictionary] objectForKey:@\"CFBundleShortVersionString\"],\n                                                        @\"platform\":@\"iOS\"};\n```\n\n\n\n#### Timeout seconds\n\n```objective-c\n[SJNetworkConfig sharedConfig].timeoutSeconds = 30;//default is 20s\n```\n\n\n\n#### Debug mode\n\n```objective-c\n[SJNetworkConfig sharedConfig].debugMode = YES;//default is NO\n```\n\n\n\n\n\n#### Add request header\n\n```objective-c\n[[SJNetworkConfig sharedConfig] addCustomHeader:@{@\"token\":@\"2j4jd9s74bfm9sn3\"}];\n```\n\nor\n\n```objective-c\n[[SJNetworkManager sharedManager] addCustomHeader:@{@\"token\":@\"2j4jd9s74bfm9sn3\"}];\n```\n\n\n\n> The input key-value pair will be added in network request header.\n>\n> If a pair with same key-value dose not exist, then add it, if it exists, then replace it.\n\n\n\n\n\n### Ordinary Network Request\n\n\nPOST request (none writing or none loading cache):\n\n```objective-c\n[[SJNetworkManager sharedManager] sendPostRequest:@\"toutiao/index\"\n                                       parameters:@{@\"type\":@\"top\",\n                                                    @\"key\" :@\"0c60\"}\n  \n     success:^(id responseObject) {\n\n  } failure:^(NSURLSessionTask *task, NSError *error, NSInteger statusCode) {\n\n  }];\n```\n\n\n\nPOST request ( writing and loading cache):\n\n\n\n```objective-c\n[[SJNetworkManager sharedManager] sendPostRequest:@\"toutiao/index\"\n                                       parameters:@{@\"type\":@\"top\",\n                                                    @\"key\" :@\"0c60\"}\n                                        loadCache:YES\n                                    cacheDuration:180\n  success:^(id responseObject) {\n\n} failure:^(NSURLSessionTask *task, NSError *error, NSInteger statusCode) {\n\n}];\n```\n\n\n\n> If loadcache is set to be YES, then try to load cache before sending network request.\n>\n> If cacheDuration is set to be more than 0, then write cache after receiving response object.\n\n\n\nFlow chart of cache operation in ordinary requests:\n\n![](http://oih3a9o4n.bkt.clouddn.com/request-blackwhite.png)\n\n\n\n### Cache Operation\n\n \n\n#### Loading cache\n\n\n\nLoading cache of a specific network request:\n\n```objective-c\n[[SJNetworkManager sharedManager] loadCacheWithUrl:@\"toutiao/index\"\n                                            method:@\"POST\"\n                                        parameters:@{@\"type\":@\"top\",\n                                                     @\"key\" :@\"0c60\"}\n                                 completionBlock:^(id  _Nullable cacheObject) {                               \n}];\n```\n\n\n\nLoading cache of network requests share the same request url:\n\n```objective-c\n[[SJNetworkManager sharedManager] loadCacheWithUrl:@\"toutiao/index\"\n                                   completionBlock:^(NSArray * _Nullable cacheArr) {\n}];\n```\n\n\n\nLoading cache of network requests which share the same request url and method:\n\n```objective-c\n[[SJNetworkManager sharedManager] loadCacheWithUrl:@\"toutiao/index\"\n                                            method:@\"POST\"\n                                   completionBlock:^(NSArray * _Nullable cacheArr) {\n}];\n```\n\n\n\n#### Clearing Cache\n\n\n\nClearing cache of one specific network request:\n\n```objective-c\n[[SJNetworkManager sharedManager] clearCacheWithUrl:@\"toutiao/index\"\n                                             method:@\"POST\"\n                                         parameters:@{@\"type\":@\"top\",\n                                                      @\"key\" :@\"0c60\"}\n                                    completionBlock:^(BOOL isSuccess) {\n}];\n```\n\n\n\n\n\nClearing cache of network requests share the same request url:\n\n```objective-c\n[[SJNetworkManager sharedManager] clearCacheWithUrl:@\"toutiao/index\"\n                                    completionBlock:^(BOOL isSuccess) {\n}];\n```\n\n\n\n\n\nClearing cache of network requests which share the same request url and method:\n\n```objective-c\n[[SJNetworkManager sharedManager] clearCacheWithUrl:@\"toutiao/index\"\n                                             method:@\"POST\"\n                                    completionBlock:^(BOOL isSuccess) {\n}];\n```\n\n\n\n#### Calculating Cache\n\nCalculating the size of cache folder:\n\n```objective-c\n[[SJNetworkManager sharedManager] calculateCacheSizeWithCompletionBlock:^(NSUInteger fileCount, NSUInteger totalSize, NSString *totalSizeString) {\n        \n        NSLog(@\"file count :%lu and total size:%lu total size string:%@\",(unsigned long)fileCount,(unsigned long)totalSize, totalSizeString);\n        \n}];\n```\n\n\n\n> **fileCount**:file counts in cache folder\n>\n> **totalSize**: size of cache folder(unit is byte)\n>\n> **totalSizeString**:size of cache folder (size of unit)  eg.``file count :5 and total size:1298609 total size string:1.2385 MB``\n\n\n\n\n\n\n\n### Uploading Function\n\nUploading one image, original size:\n\n\n\n```objective-c\n[[SJNetworkManager sharedManager]  sendUploadImageRequest:@\"api\"\n                                               parameters:nil\n                                                    image:image_1\n                                                     name:@\"universe\"\n                                                 mimeType:@\"png\"\n                                                 progress:^(NSProgress *uploadProgress) {\n                                                        \n  self.progressView.observedProgress = uploadProgress;\n\n} success:^(id responseObject) {\n\n} failure:^(NSURLSessionTask *task, NSError *error, NSInteger statusCode, NSArray<UIImage *> *uploadFailedImages) {\n\n}];\n```\n\n\n\n> Here, the mimeType can be jpg/JPG, png/PNG, jpeg/JPEG and if the user gives a wrong type, the mimeType will be jpg.\n\n\n\nUploading two images, compress ratio is 0.5(note that if the mineType is 'png' or 'PNG', the compressRatio will be useless):\n\n\n\n```objective-c\n[[SJNetworkManager sharedManager]  sendUploadImagesRequest:@\"api\"\n                                                parameters:nil\n                                                    images:@[image_1,image_2]\n                                             compressRatio:0.5\n                                                      name:@\"images\"\n                                                  mimeType:@\"jpg\"\n                                                  progress:^(NSProgress *uploadProgress) {\n\n  self.progressView.observedProgress = uploadProgress;\n\n} success:^(id responseObject) {\n\n} failure:^(NSURLSessionTask *task, NSError *error, NSInteger statusCode, NSArray<UIImage *> *uploadFailedImages) {\n                                                    \n}];\n```\n\n\n\n\n\nAnd if the server which is used for uploading is **different from** the server for ordinary requests, you can user this api:\n\n```objective-c\n[[SJNetworkManager sharedManager]  sendUploadImagesRequest:@\"http://uploads.im/api\"\n                                               ignoreBaseUrl:YES\n                                                  parameters:nil\n                                                      images:@[image_1,image_2]\n                                               compressRatio:0.5\n                                                        name:@\"images\"\n                                                    mimeType:@\"jpg\"\n                                                    progress:^(NSProgress *uploadProgress) {\n\n      self.progressView.observedProgress = uploadProgress;\n\n  } success:^(id responseObject) {\n\n  } failure:^(NSURLSessionTask *task, NSError *error, NSInteger statusCode, NSArray<UIImage *> *uploadFailedImages) {\n\n  }];\n```\n\n\n\n> Here, setting ignoreBaseUrl to be YES, and the request url should be complete download url.\n\n\n\n\n\n### Downloading Function:\n\n\nWe support background downloading(using NSURLSessionDownloadTask object ) and none-background downloading(using NSURLSessionDataTask object) , resumable or none-resumable downloading.\n\n\n\n|                            | resumable | none-resumable |\n| -------------------------- | --------- | -------------- |\n| background supporting      | ✅         | ✅              |\n| none-background supporting | ✅         | ✅              |\n\n\n\n> **Note**:If a none-background supporting downloading is on going then app enters into background, the downloading task will be canceled. And When app enters into foreground again, an ``auto-resume mechanism`` will make the downloading task restart again.\n\n\n\n\n\n#### Sending download request\n\n\n\nResumable && none-background supporting download reqeust (default configuration):\n\n```objective-c\n[[SJNetworkManager sharedManager] sendDownloadRequest:@\"wallpaper.jpg\"\n                                     downloadFilePath:_imageFileLocalPath\n                                             progress:^(NSInteger receivedSize, NSInteger expectedSize, CGFloat progress)\n{\n       self.progressView.progress = progress;\n\n} success:^(id responseObject) {\n\n} failure:^(NSURLSessionTask *task, NSError *error, NSString *resumableDataPath) {\n\n}];\n```\n\n\n\nNone-resumable && none-background supporting download reqeust:\n\n```objective-c\n[[SJNetworkManager sharedManager] sendDownloadRequest:@\"half-eatch.jpg\"\n                                     downloadFilePath:_imageFileLocalPath\n                                            resumable:NO\n                                    backgroundSupport:NO\n                                             progress:^(NSInteger receivedSize, NSInteger expectedSize, CGFloat progress) \n{\n\n    self.progressView.progress = progress;\n\n} success:^(id responseObject) {\n\n} failure:^(NSURLSessionTask *task, NSError *error, NSString *resumableDataPath) {\n    \n}];\n```\n\n\n\n\n\nResumable && background supporting download request:\n\n```objective-c\n[[SJNetworkManager sharedManager] sendDownloadRequest:@\"universe.jpg\"\n                                     downloadFilePath:_imageFileLocalPath\n                                            resumable:YES\n                                    backgroundSupport:YES\n                                             progress:^(NSInteger receivedSize, NSInteger expectedSize, CGFloat progress)\n{\n\n    self.progressView.progress = progress;\n\n} success:^(id responseObject) {\n\n} failure:^(NSURLSessionTask *task, NSError *error, NSString *resumableDataPath) {\n\n}];\n```\n\n\n\nNone-resumable && background supporting download request:\n\n```objective-c\n[[SJNetworkManager sharedManager] sendDownloadRequest:@\"iceberg.jpg\"\n                                     downloadFilePath:_imageFileLocalPath\n                                            resumable:NO\n                                    backgroundSupport:YES\n                                             progress:^(NSInteger receivedSize, NSInteger expectedSize, CGFloat progress)\n{\n\n    self.progressView.progress = progress;\n\n } success:^(id responseObject) {\n\n } failure:^(NSURLSessionTask *task, NSError *error, NSString *resumableDataPath) {\n\n }];\n```\n\n\n\nAlso supports ignoring base url:\n\n```objective-c\n[[SJNetworkManager sharedManager] sendDownloadRequest:@\"http://oih3a9o4n.bkt.clouddn.com/wallpaper.jpg\"\n                                        ignoreBaseUrl:YES\n                                     downloadFilePath:_imageFileLocalPath\n                                             progress:^(NSInteger receivedSize, NSInteger expectedSize, CGFloat progress)\n{\n      self.progressView.progress = progress;\n\n} success:^(id responseObject) {\n\n} failure:^(NSURLSessionTask *task, NSError *error, NSString *resumableDataPath) {\n\n}];\n```\n\n\n\n#### Suspending download request\n\n\n\nSuspending one download  current request:\n\n```objective-c\n[[SJNetworkManager sharedManager] suspendDownloadRequest:@\"universe.jpg\"];\n```\n\n\n\nSuspending one or more than one current download requests:\n\n```objective-c\n[[SJNetworkManager sharedManager] suspendDownloadRequests:@[@\"universe.jpg\",@\"wallpaper.jpg\"]];\n```\n\n\n\nSuspending all current download requests:\n\n```objective-c\n[[SJNetworkManager sharedManager] suspendAllDownloadRequests];\n```\n\n\n\n#### Resuming download request\n\n\n\nResuming one download  suspended request:\n\n```objective-c\n[[SJNetworkManager sharedManager] resumeDownloadReqeust:@\"universe.jpg\"];\n```\n\n\n\nResuming one or more than one download requests:\n\n```objective-c\n[[SJNetworkManager sharedManager] resumeDownloadReqeusts:@[@\"universe.jpg\",@\"wallpaper.jpg\"]];\n```\n\n\n\nResuming all current suspended requests:\n\n```objective-c\n[[SJNetworkManager sharedManager] resumeAllDownloadRequests];\n```\n\n\n\n\n\n#### Canceling download request\n\n\n\nCanceling one download request:\n\n```objective-c\n[[SJNetworkManager sharedManager] cancelDownloadRequest:@\"universe.jpg\"];\n```\n\n\n\nCanceling one or more than one current download requests:\n\n```objective-c\n[[SJNetworkManager sharedManager] cancelDownloadRequests:@[@\"universe.jpg\",@\"wallpaper.jpg\"]];\n```\n\n\n\nCanceling all current download requests:\n\n```objective-c\n[[SJNetworkManager sharedManager] cancelAllDownloadRequests];\n```\n\n\n\n\n\n### Request Management\n\n\n\n#### Current request(s) Information\n\n\n\nChecking if there is remaining current request(s):\n\n```objective-c\nBOOL remaining =  [[SJNetworkManager sharedManager] remainingCurrentRequests];\nif (remaining) {\n    NSLog(@\"There is remaining request\");\n}\n```\n\n\n\nCalculating count of current request(s):\n\n```objective-c\nNSUInteger count = [[SJNetworkManager sharedManager] currentRequestCount];\nif (count > 0) {\n    NSLog(@\"There is %lu requests\",(unsigned long)count);\n}\n```\n\n\n\nLogging all current request(s)：\n\n```objective-c\n[[SJNetworkManager sharedManager] logAllCurrentRequests];\n```\n\n\n\n#### Canceling request\n\n\n\nCanceling one network request:\n\n```objective-c\n[[SJNetworkManager sharedManager] cancelCurrentRequestWithUrl:@\"toutiao/index\"\n                                                       method:@\"POST\"\n                                                   parameters:@{@\"type\":@\"top\",\n                                                                @\"key\" :@\"0c60\"}];\n```\n\n\n\nCanceling network request(s) with the same url:\n\n```objective-c\n[[SJNetworkManager sharedManager] cancelCurrentRequestWithUrl:@\"toutiao/index\"];\n```\n\n\n\nCanceling network request(s) with the same urls:\n\n```objective-c\n[[SJNetworkManager sharedManager] cancelDownloadRequests:@[@\"toutiao/index\",@\"weixin/query\"]];\n```\n\n\n\nCanceling all current network request(s):\n\n```objective-c\n[[SJNetworkManager sharedManager] cancelAllCurrentRequests];\n```\n\n\n\n \t\n\n### Log Output\n\n\n\nIf debug mode is set to be yes, detail log will be provided:\n\n```objective-c\n[SJNetworkConfig sharedConfig].debugMode = YES;\n```\n\n\n\nLoading cache before sending network request, but cache is expired:\n\n```objective-c\n=========== Load cache info failed, reason:Cache is expired, begin to clear cache...\n=========== Load cache failed: Cache info is invalid \n=========== Failed to load cache, start to sending network request...\n=========== Start requesting...\n=========== url:http://v.juhe.cn/toutiao/index\n=========== method:GET\n=========== parameters:{\n    app_version = 1.0;\n    key = 0c60;\n    platform = iOS;\n    type = top;\n}\n=========== Request succeed! \n=========== Request url:http://v.juhe.cn/toutiao/index\n=========== Response object:{\n  code = 200,\n  msg = \"\",\n  data = {}\n}\n=========== Write cache succeed!\n=========== cache object: {\n  code = 200,\n  msg = \"\",\n  data = {}\n}\n=========== Cache path: /Users/*******/\n=========== Available duration: 180 seconds\n```\n\n\n\n## Acknowledgements\n\n\n\nThanks for these service:\n\n- [JuHe.cn](https://www.juhe.cn/): GET/POST api\n- [Uploads.im](http://uploads.im) : Uploading api\n- [QINIU](https://portal.qiniu.com/): Multimedia cloud server(for downloading files)\n\n\n\nAnd also thanks for these two excellent framework:\n\n- [AFNetworking](https://github.com/AFNetworking/AFNetworking)\n- [YTKNetwork](https://github.com/yuantiku/YTKNetwork)\n\n\n\n\n\n## Lisence\n\nSJNetwork is released under the [MIT License](https://github.com/knightsj/SJNetwork/blob/master/LICENSE).\n\n\n\n\n\n\n\n"
  },
  {
    "path": "SJNetwork/SJNetwork.h",
    "content": "//\n//  SJNetwork.h\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/12/27.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#ifndef SJNetwork_h\n#define SJNetwork_h\n\n#import \"SJNetworkManager.h\"\n#import \"SJNetworkConfig.h\"\n\n#endif /* SJNetwork_h */\n"
  },
  {
    "path": "SJNetwork/SJNetworkBaseEngine.h",
    "content": "//\n//  SJNetworkBaseEngine.h\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/12/26.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n#import \"SJNetworkRequestModel.h\"\n\n\n@interface SJNetworkBaseEngine : NSObject\n\n\n/**\n *  This method is used to add customed headers, for subclass to override\n */\n- (void)addCustomHeaders;\n\n\n\n/**\n *  This method is used to add default parameters with custom parameters, for subclass to override\n *\n *  @param parameters        custom parameters\n *\n */\n- (id)addDefaultParametersWithCustomParameters:(id)parameters;\n\n\n\n\n/**\n *  This method is used to execute some operation with the request model when the corresponding request succeed, for subclass to override\n *\n *  @param requestModel      request model of a network request\n *\n */\n- (void)requestDidSucceedWithRequestModel:(SJNetworkRequestModel *)requestModel;\n\n\n\n@end\n"
  },
  {
    "path": "SJNetwork/SJNetworkBaseEngine.m",
    "content": "//\n//  SJNetworkBaseEngine.m\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/12/26.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"SJNetworkBaseEngine.h\"\n\n@implementation SJNetworkBaseEngine\n\n\n- (void)addCustomHeaders{\n    \n}\n\n\n\n- (id)addDefaultParametersWithCustomParameters:(id)parameters{\n    return nil;\n}\n\n\n\n- (void)requestDidSucceedWithRequestModel:(SJNetworkRequestModel *)requestModel{\n    \n    \n}\n\n\n\n- (void)requestDidFailedWithRequestModel:(SJNetworkRequestModel *)requestModel error:(NSError *)error{\n    \n    \n}\n\n@end\n"
  },
  {
    "path": "SJNetwork/SJNetworkCacheInfo.h",
    "content": "//\n//  SJNetworkCacheInfo.h\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/25.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n\n#import <Foundation/Foundation.h>\n\n\n/* =============================\n *\n * SJNetworkCacheInfo\n *\n * SJNetworkCacheInfo is in charge of recording the infomation of cache which is related to a specific network request\n *\n * =============================\n */\n\n@interface SJNetworkCacheInfo : NSObject<NSSecureCoding>\n\n// Record the creation date of the cache\n@property (nonatomic, readwrite, strong) NSDate *creationDate;\n\n// Record the length of the period of validity (unit is second)\n@property (nonatomic, readwrite, strong) NSNumber *cacheDuration;\n\n// Record the app version when the cache is created\n@property (nonatomic, readwrite, copy)   NSString *appVersionStr;\n\n// Record the request identifier of the cache\n@property (nonatomic, readwrite, copy)   NSString *reqeustIdentifer;\n\n@end\n"
  },
  {
    "path": "SJNetwork/SJNetworkCacheInfo.m",
    "content": "//\n//  SJNetworkCacheInfo.m\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/25.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"SJNetworkCacheInfo.h\"\n\n@implementation SJNetworkCacheInfo\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n- (void)encodeWithCoder:(NSCoder *)aCoder{\n    \n    [aCoder encodeObject:self.cacheDuration forKey:NSStringFromSelector(@selector(cacheDuration))];\n    [aCoder encodeObject:self.creationDate forKey:NSStringFromSelector(@selector(creationDate))];\n    [aCoder encodeObject:self.appVersionStr forKey:NSStringFromSelector(@selector(appVersionStr))];\n    [aCoder encodeObject:self.reqeustIdentifer forKey:NSStringFromSelector(@selector(reqeustIdentifer))];\n}\n\n- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder {\n    \n    self = [self init];\n    \n    if (self) {\n        \n        self.cacheDuration = [aDecoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(cacheDuration))];\n        self.creationDate = [aDecoder decodeObjectOfClass:[NSDate class] forKey:NSStringFromSelector(@selector(creationDate))];\n        self.appVersionStr = [aDecoder decodeObjectOfClass:[NSString class] forKey:NSStringFromSelector(@selector(appVersionStr))];\n        self.reqeustIdentifer = [aDecoder decodeObjectOfClass:[NSString class] forKey:NSStringFromSelector(@selector(reqeustIdentifer))];\n    }\n\n    return self;\n}\n\n- (NSString *)description{\n\n    return [NSString stringWithFormat:@\"{cacheDuration:%@},{creationDate:%@},{appVersion:%@},{requestIdentifer:%@}\",_cacheDuration,_creationDate,_appVersionStr,_reqeustIdentifer];\n}\n\n@end\n"
  },
  {
    "path": "SJNetwork/SJNetworkCacheManager.h",
    "content": "//\n//  SJNetworkCache.h\n//  SJNetwork\n//\n//  Created by Sun Shijie on 2017/8/16.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n\n@class SJNetworkRequestModel;\n@class SJNetworkDownloadResumeDataInfo;\n\n\n// Callback when the cache is cleared\ntypedef void(^SJClearCacheCompletionBlock)(BOOL isSuccess);\n\n// Callback when the cache is loaded\ntypedef void(^SJLoadCacheCompletionBlock)(id _Nullable cacheObject);\n\n// Callback when cache array is loaded\ntypedef void(^SJLoadCacheArrCompletionBlock)(NSArray * _Nullable cacheArr);\n\n// Callback when the size of cache is calculated\ntypedef void(^SJCalculateSizeCompletionBlock)(NSUInteger fileCount, NSUInteger totalSize, NSString * _Nonnull totalSizeString);\n\n\n\n/* =============================\n *\n * SJNetworkCacheManager\n *\n * SJNetworkCacheManager is in charge of managing operations of oridinary request cache(and cache info) and resume data (and resume data info)of a certain download request\n *\n * =============================\n */\n\n@interface SJNetworkCacheManager : NSObject\n\n\n\n/**\n *  SJNetworkCacheManager Singleton\n *\n *  @return SJNetworkCacheManager singleton instance\n */\n+ (SJNetworkCacheManager *_Nonnull)sharedManager;\n\n\n\n\n\n//============================ Write Cache ============================//\n\n/**\n *  This method is used to write cache(cache data and cache info), \n    can only be called by SJNetworkManager instance\n *\n *  @param requestModel        the model holds the configuration of a specific request\n *  @param asynchronously      if write cache asynchronously\n *\n */\n- (void)writeCacheWithReqeustModel:(SJNetworkRequestModel * _Nonnull)requestModel asynchronously:(BOOL)asynchronously;\n\n\n\n\n//============================= Load cache =============================//\n\n\n/**\n *  This method is used to load cache which is related to a specific url,\n    no matter what request method is or parameters are\n *\n *\n *  @param url                  the url of related network requests\n *  @param completionBlock      callback\n *\n */\n- (void)loadCacheWithUrl:(NSString * _Nonnull)url completionBlock:(SJLoadCacheArrCompletionBlock _Nullable)completionBlock;\n\n\n\n\n- (void)loadCacheWithUrl:(NSString * _Nonnull)url\n                  method:(NSString * _Nonnull)method\n         completionBlock:(SJLoadCacheArrCompletionBlock _Nullable)completionBlock;\n\n\n\n/**\n *  This method is used to load cache which is related to a specific url,method and parameters\n *\n *  @param url                  the url of the network request\n *  @param method               the method of the network request\n *  @param parameters           the parameters of the network request\n *  @param completionBlock      callback\n *\n */\n- (void)loadCacheWithUrl:(NSString * _Nonnull)url\n                  method:(NSString * _Nonnull)method\n              parameters:(id _Nullable)parameters\n         completionBlock:(SJLoadCacheCompletionBlock _Nullable)completionBlock;\n\n\n\n\n\n/**\n *  This method is used to load cache which is related to a identier which is the unique to a network request,\n    can only be called by SJNetworkManager instance\n *\n *  @param requestIdentifer     the unique identier of a specific  network request\n *  @param completionBlock      callback\n *\n */\n- (void)loadCacheWithRequestIdentifer:(NSString * _Nonnull)requestIdentifer completionBlock:(SJLoadCacheCompletionBlock _Nullable)completionBlock;\n\n\n\n\n\n//============================ calculate cache ============================//\n\n/**\n *  This method is used to calculate the size of the cache folder (include ordinary request cache and download resume data file and resume data info file)\n *\n *  @param completionBlock      finish callback\n *\n */\n- (void)calculateAllCacheSizecompletionBlock:(SJCalculateSizeCompletionBlock _Nullable)completionBlock;\n\n\n\n\n\n//============================== clear cache ==============================//\n\n/**\n *  This method is used to clear all cache which is in the cache folder\n *\n *  @param completionBlock      callback\n *\n */\n- (void)clearAllCacheCompletionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock;\n\n\n\n\n/**\n *  This method is used to clear the cache which is related the specific url,\n    no matter what request method is or parameters are\n *\n *  @param url                   the url of network request\n *  @param completionBlock       callback\n *\n */\n- (void)clearCacheWithUrl:(NSString * _Nonnull)url completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock;\n\n\n\n\n- (void)clearCacheWithUrl:(NSString * _Nonnull)url\n                   method:(NSString * _Nonnull)method\n          completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock;\n\n\n/**\n *  This method is used to clear cache which is related to a specific url,method and parameters\n *\n *  @param url                  the url of the network request\n *  @param method               the method of the network request\n *  @param parameters           the parameters of the network request\n *  @param completionBlock      callback\n *\n */\n- (void)clearCacheWithUrl:(NSString * _Nonnull)url\n                   method:(NSString * _Nonnull)method\n               parameters:(id _Nullable)parameters\n          completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock;\n\n\n\n//============================== Update resume data or resume data info ==============================//\n\n/**\n *  This method is used to update resume data info after suspending a download request\n *\n *  @param requestModel      request model of a network requst\n *\n */\n- (void)updateResumeDataInfoAfterSuspendWithRequestModel:(SJNetworkRequestModel *_Nonnull)requestModel;\n\n\n\n\n/**\n *  This method is used to remove resume data and resume data info files\n *\n *  @param requestModel      request model of a network requst\n *\n */\n- (void)removeResumeDataAndResumeDataInfoFileWithRequestModel:(SJNetworkRequestModel *_Nonnull)requestModel;\n\n\n\n\n\n/**\n *  This method is used to remove download data to target download file path and clear the resume data info file\n *\n *  @param requestModel      request model of a network requst\n *\n */\n- (void)removeCompleteDownloadDataAndClearResumeDataInfoFileWithRequestModel:(SJNetworkRequestModel *_Nonnull)requestModel;\n\n\n\n\n//============================== Load resume data info ==============================//\n\n/**\n *  This method is used to load resume data info in a given file path\n *\n *  @param filePath          file path\n *\n */\n- (SJNetworkDownloadResumeDataInfo *_Nullable)loadResumeDataInfo:(NSString *_Nonnull)filePath;\n\n\n@end\n"
  },
  {
    "path": "SJNetwork/SJNetworkCacheManager.m",
    "content": "//\n//  SJNetworkCache.m\n//  SJNetwork\n//\n//  Created by Sun Shijie on 2017/8/16.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"SJNetworkCacheManager.h\"\n#import \"SJNetworkRequestModel.h\"\n#import \"SJNetworkConfig.h\"\n#import \"SJNetworkUtils.h\"\n#import \"SJNetworkCacheInfo.h\"\n#import \"SJNetworkDownloadResumeDataInfo.h\"\n\n\n\n#ifndef NSFoundationVersionNumber_iOS_8_0\n#define NSFoundationVersionNumber_With_QoS_Available 1140.11\n#else\n#define NSFoundationVersionNumber_With_QoS_Available NSFoundationVersionNumber_iOS_8_0\n#endif\n\n\nstatic dispatch_queue_t sj_cache_io_queue() {\n    \n    static dispatch_queue_t queue;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        dispatch_queue_attr_t attr = DISPATCH_QUEUE_SERIAL;\n        if (NSFoundationVersionNumber >= NSFoundationVersionNumber_With_QoS_Available) {\n            attr = dispatch_queue_attr_make_with_qos_class(attr, QOS_CLASS_BACKGROUND, 0);\n        }\n        queue = dispatch_queue_create(\"com.sj.caching.io\", attr);\n    });\n    \n    return queue;\n}\n\n\n\n\n\n@implementation SJNetworkCacheManager{\n    \n    NSFileManager *_fileManager;\n    NSString *_cacheBasePath;\n    BOOL _isDebugMode;\n}\n\n\n#pragma mark- ============== Life Cycle Methods ==============\n\n\n+ (SJNetworkCacheManager *_Nonnull)sharedManager{\n    \n    static SJNetworkCacheManager *sharedManager = nil;\n    static dispatch_once_t onceToken;\n    \n    dispatch_once(&onceToken, ^{\n        sharedManager = [[SJNetworkCacheManager alloc] init];\n    });\n    return sharedManager;\n}\n\n\n- (instancetype)init{\n    \n    self = [super init];\n    if (self) {\n        \n        _fileManager = [NSFileManager defaultManager];\n        _cacheBasePath = [SJNetworkUtils createCacheBasePath];\n        _isDebugMode = [SJNetworkConfig sharedConfig].debugMode;\n        \n    }\n    return self;\n}\n\n//==================== Write Cache ====================//\n\n#pragma mark- ============== Public Methods ==============\n\n\n#pragma mark Write Cache\n\n- (void)writeCacheWithReqeustModel:(SJNetworkRequestModel * _Nonnull)requestModel asynchronously:(BOOL)asynchronously{\n    \n    \n    if (asynchronously) {\n        \n        dispatch_async(sj_cache_io_queue(), ^{\n            [self p_wrtieCacheWithRequestModel:requestModel];\n        });\n        \n    }else{\n        \n        [self p_wrtieCacheWithRequestModel:requestModel];\n    }\n}\n\n\n\n#pragma mark Load Cache\n\n\n\n- (void)loadCacheWithUrl:(NSString * _Nonnull)url completionBlock:(SJLoadCacheArrCompletionBlock _Nullable)completionBlock{\n    \n    NSString *partialIdentifier = [SJNetworkUtils generatePartialIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                           requestUrlStr:url\n                                                                               methodStr:nil];\n    \n    [self p_loadCacheWithPartialIdentifier:partialIdentifier completionBlock:completionBlock];\n\n}\n\n\n- (void)loadCacheWithUrl:(NSString * _Nonnull)url\n                  method:(NSString * _Nonnull)method\n         completionBlock:(SJLoadCacheArrCompletionBlock _Nullable)completionBlock{\n    \n    \n    NSString *partialIdentifier = [SJNetworkUtils generatePartialIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                           requestUrlStr:url\n                                                                               methodStr:method];\n    \n    [self p_loadCacheWithPartialIdentifier:partialIdentifier completionBlock:completionBlock];\n    \n}\n\n\n\n\n- (void)loadCacheWithUrl:(NSString * _Nonnull)url\n                  method:(NSString * _Nonnull)method\n              parameters:(id _Nullable)parameters\n         completionBlock:(SJLoadCacheCompletionBlock _Nullable)completionBlock{\n\n    NSString *requestIdentifer = [SJNetworkUtils generateRequestIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                          requestUrlStr:url\n                                                                              methodStr:method\n                                                                             parameters:parameters];\n    \n    [self loadCacheWithRequestIdentifer:requestIdentifer completionBlock:^(NSArray * _Nullable cacheArr) {\n        \n        if (completionBlock) {\n            completionBlock(cacheArr);\n        }\n    \n    }];\n    \n}\n\n\n\n- (void)loadCacheWithRequestIdentifer:(NSString * _Nonnull)requestIdentifer\n                      completionBlock:(SJLoadCacheCompletionBlock _Nullable)completionBlock{\n    \n    NSString *cacheDataFilePath = [SJNetworkUtils cacheDataFilePathWithRequestIdentifer:requestIdentifer];\n    NSString *cacheInfoFilePath = [SJNetworkUtils cacheDataInfoFilePathWithRequestIdentifer:requestIdentifer];\n    \n    //load cache info\n    SJNetworkCacheInfo *cacheInfo = [self p_loadCacheInfoWithRequestIdentifier:requestIdentifer];\n    \n    if (!cacheInfo) {\n        \n        if (_isDebugMode) {\n            SJLog(@\"=========== Load cache failed: Cache info dose not exists in path:%@\",cacheInfoFilePath);\n        }\n        \n        [self removeCacheDataFile:cacheDataFilePath cacheInfoFile:cacheInfoFilePath];\n        \n        dispatch_async(dispatch_get_main_queue(), ^{\n            if (completionBlock) {\n                completionBlock(nil);\n            }\n        });\n        \n        return;\n    }\n    \n    BOOL cacheValidation = [self p_checkCacheValidation:cacheInfo];\n    \n    if (!cacheValidation) {\n        \n        if (_isDebugMode) {\n            SJLog(@\"=========== Load cache failed: Cache info is invalid\");\n        }\n        \n        [self removeCacheDataFile:cacheDataFilePath cacheInfoFile:cacheInfoFilePath];\n        \n        \n        dispatch_async(dispatch_get_main_queue(), ^{\n            if (completionBlock) {\n                completionBlock(nil);\n            }\n        });\n        \n        return;\n        \n    }\n    \n    id cacheObject = [self p_loadCacheObjectWithCacheFilePath:cacheDataFilePath];\n    \n    if (!cacheObject) {\n        \n        if (_isDebugMode) {\n            SJLog(@\"=========== Load cache failed: Cache data is missing\");\n        }\n        \n        [self removeCacheDataFile:cacheDataFilePath cacheInfoFile:cacheInfoFilePath];\n        \n        dispatch_async(dispatch_get_main_queue(), ^{\n            if (completionBlock) {\n                completionBlock(nil);\n            }\n        });\n        \n        return;\n        \n    }else {\n        \n        \n        if (_isDebugMode) {\n            SJLog(@\"=========== Load cache succeed: Cache loacation:%@\",cacheDataFilePath);\n        }\n        \n        dispatch_async(dispatch_get_main_queue(), ^{\n            if (completionBlock) {\n                completionBlock(cacheObject);\n            }\n        });\n    }\n}\n\n\n\n\n#pragma mark Calculate Cache\n\n- (void)calculateAllCacheSizecompletionBlock:(SJCalculateSizeCompletionBlock _Nullable)completionBlock{\n\n    NSURL *diskCacheURL = [NSURL fileURLWithPath:_cacheBasePath isDirectory:YES];\n    \n    dispatch_async(sj_cache_io_queue(), ^{\n        \n        NSUInteger fileCount = 0;\n        NSUInteger totalSize = 0;\n        \n        NSDirectoryEnumerator *fileEnumerator = [_fileManager enumeratorAtURL:diskCacheURL\n                                                   includingPropertiesForKeys:@[NSFileSize]\n                                                                      options:NSDirectoryEnumerationSkipsHiddenFiles\n                                                                 errorHandler:NULL];\n        \n        for (NSURL *fileURL in fileEnumerator) {\n            NSNumber *fileSize;\n            [fileURL getResourceValue:&fileSize forKey:NSURLFileSizeKey error:NULL];\n            totalSize += fileSize.unsignedIntegerValue;\n            fileCount += 1;\n        }\n        \n        NSString *totalSizeStr = nil;\n        NSUInteger mb = 1024 *1024;\n        if (totalSize <mb) {\n            totalSizeStr = [NSString stringWithFormat:@\"%.4f KB\",(totalSize * 1.0/1024)];\n        }else{\n            totalSizeStr = [NSString stringWithFormat:@\"%.4f MB\",totalSize * 1.0/(mb)];\n        }\n        if (_isDebugMode) {\n            SJLog(@\"=========== Calculate cache size succeed:total fileCount:%ld & totalSize:%@\",(unsigned long)fileCount,totalSizeStr);\n        }\n        if (completionBlock) {\n            dispatch_async(dispatch_get_main_queue(), ^{                \n                completionBlock(fileCount, totalSize, totalSizeStr);\n            });\n        }\n    });\n\n}\n\n\n#pragma mark Clear Cache\n\n- (void)clearAllCacheCompletionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock{\n\n    dispatch_async(sj_cache_io_queue(), ^{\n        \n        NSError *removeCacheFolderError = nil;\n        NSError *createCacheFolderError = nil;\n        [_fileManager removeItemAtPath:_cacheBasePath error:&removeCacheFolderError];\n        \n        if (!removeCacheFolderError) {\n            \n            [_fileManager createDirectoryAtPath:_cacheBasePath\n                    withIntermediateDirectories:YES\n                                     attributes:nil\n                                          error:&createCacheFolderError];\n            \n            if (!createCacheFolderError) {\n                \n                dispatch_async(dispatch_get_main_queue(), ^{\n                SJLog(@\"=========== Clearing all cache successfully\");\n                if (completionBlock) {\n                        completionBlock(YES);\n                        return;\n                }\n                });\n            }else{\n                \n                dispatch_async(dispatch_get_main_queue(), ^{\n                if (_isDebugMode) {\n                    SJLog(@\"=========== Clearing cache error: Failed to create cache folder after removing it\");\n                }\n                if(completionBlock) {\n                    \n                        completionBlock(NO);\n                        return;\n                      }\n                });\n              \n            }\n        }else{\n            \n            dispatch_async(dispatch_get_main_queue(), ^{\n                if (_isDebugMode) {\n                    SJLog(@\"=========== Clearing cache error: Failed to remove cache folder\");\n                }\n                if (completionBlock) {\n                    completionBlock(NO);\n                    return;\n                }\n            });\n               \n        };\n    });\n}\n\n\n\n- (void)clearCacheWithUrl:(NSString * _Nonnull)url completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock{\n\n    \n    NSString *partiticalIdentifier = [SJNetworkUtils generatePartialIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                              requestUrlStr:url\n                                                                                  methodStr:nil];\n    \n    [self p_clearCacheWithIdentifier:partiticalIdentifier completionBlock:completionBlock];\n    \n}\n\n\n\n\n- (void)clearCacheWithUrl:(NSString * _Nonnull)url\n                   method:(NSString * _Nonnull)method\n          completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock{\n    \n    NSString *partiticalIdentifier = [SJNetworkUtils generatePartialIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                              requestUrlStr:url\n                                                                                  methodStr:method];\n    \n    [self p_clearCacheWithIdentifier:partiticalIdentifier completionBlock:completionBlock];\n}\n\n\n\n\n- (void)clearCacheWithUrl:(NSString * _Nonnull)url\n                   method:(NSString * _Nonnull)method\n               parameters:(id _Nullable)parameters\n          completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock{\n\n    NSString *requestIdentifer = [SJNetworkUtils generateRequestIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                          requestUrlStr:url\n                                                                              methodStr:method\n                                                                             parameters:parameters];\n    \n    [self p_clearCacheWithIdentifier:requestIdentifer completionBlock:completionBlock];\n    \n}\n\n\n\n#pragma mark Update resume data or resume data info\n\n- (void)updateResumeDataInfoAfterSuspendWithRequestModel:(SJNetworkRequestModel *_Nonnull)requestModel{\n    \n    NSData *resumeData = requestModel.task.error.userInfo[NSURLSessionDownloadTaskResumeData];\n    [resumeData writeToFile:requestModel.resumeDataFilePath options:NSDataWritingAtomic error:nil];\n    \n    int64_t downloadedByte = requestModel.task.countOfBytesReceived;\n    int64_t totalByte = requestModel.task.countOfBytesExpectedToReceive;\n    CGFloat percent = 1.0 *downloadedByte/totalByte;\n    SJNetworkDownloadResumeDataInfo *dataInfo = [self loadResumeDataInfo:requestModel.resumeDataInfoFilePath];\n    dataInfo.resumeDataLength = [NSString stringWithFormat:@\"%lld\",downloadedByte];\n    dataInfo.totalDataLength = [NSString stringWithFormat:@\"%lld\",totalByte];\n    dataInfo.resumeDataRatio = [NSString stringWithFormat:@\"%.2f\",percent];\n    [NSKeyedArchiver archiveRootObject:dataInfo toFile:requestModel.resumeDataInfoFilePath];\n}\n\n\n\n\n- (void)removeResumeDataAndResumeDataInfoFileWithRequestModel:(SJNetworkRequestModel *_Nonnull)requestModel{\n    \n    [_fileManager removeItemAtPath:requestModel.resumeDataFilePath error:nil];\n    [_fileManager removeItemAtPath:requestModel.resumeDataInfoFilePath error:nil];\n    \n}\n\n\n\n- (void)removeCompleteDownloadDataAndClearResumeDataInfoFileWithRequestModel:(SJNetworkRequestModel *_Nonnull)requestModel{\n    \n    NSError *moveFileError = nil;\n    [_fileManager moveItemAtPath:requestModel.resumeDataFilePath toPath:requestModel.downloadFilePath error:&moveFileError];\n    if (moveFileError.code == 516) {\n        [_fileManager removeItemAtPath:requestModel.resumeDataFilePath error:nil];\n    }\n    [_fileManager removeItemAtPath:requestModel.resumeDataInfoFilePath error:nil];\n    \n}\n\n\n\n- (void)removeCacheDataFile:(NSString *)cacheDataFilePath cacheInfoFile:(NSString *)cacheInfoFilePath{\n    \n    if([_fileManager fileExistsAtPath:cacheDataFilePath]){\n        [_fileManager removeItemAtPath:cacheDataFilePath error:nil];\n    }\n    \n    if([_fileManager fileExistsAtPath:cacheInfoFilePath]){\n        [_fileManager removeItemAtPath:cacheInfoFilePath error:nil];\n    }\n    \n}\n\n#pragma mark load resume data info\n\n\n- (SJNetworkDownloadResumeDataInfo *)loadResumeDataInfo:(NSString *)filePath {\n    \n    SJNetworkDownloadResumeDataInfo *dataInfo = nil;\n    if ([_fileManager fileExistsAtPath:filePath isDirectory:nil]) {\n        dataInfo = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath];\n        if ([dataInfo isKindOfClass:[SJNetworkDownloadResumeDataInfo class]]) {\n            return dataInfo;\n        }else{\n            return nil;\n        }\n    }\n    return nil;\n}\n\n\n\n\n\n#pragma mark- ============== Private Methods ==============\n\n\n- (void)p_wrtieCacheWithRequestModel:(SJNetworkRequestModel *)requestModel{\n    \n    if (requestModel.responseData) {\n        \n        //path of cache file\n        [requestModel.responseData writeToFile:requestModel.cacheDataFilePath atomically:YES];\n        \n        //write cache info data\n        SJNetworkCacheInfo *cacheInfo = [[SJNetworkCacheInfo alloc] init];\n        cacheInfo.creationDate = [NSDate date];\n        cacheInfo.cacheDuration = [NSNumber numberWithInteger:requestModel.cacheDuration];\n        cacheInfo.appVersionStr = [SJNetworkUtils appVersionStr];\n        cacheInfo.reqeustIdentifer = requestModel.requestIdentifer;\n        \n        //write cache info\n        [NSKeyedArchiver archiveRootObject:cacheInfo toFile:requestModel.cacheDataInfoFilePath];\n        \n        if (_isDebugMode) {\n            SJLog(@\"=========== Write cache succeed!\\n =========== cache object: %@\\n =========== Cache path: %@\\n =========== Available duration: %@ seconds\",requestModel.responseObject,requestModel.cacheDataFilePath,cacheInfo.cacheDuration);\n        }\n        \n    }else{\n        if (_isDebugMode) {\n            SJLog(@\"=========== Write cache failed! reason: There is no responeseData\");\n        }\n    }\n}\n\n- (void)p_loadCacheWithPartialIdentifier:(NSString *)partialIdentifier completionBlock:(SJLoadCacheArrCompletionBlock _Nullable)completionBlock{\n    \n    \n    NSDirectoryEnumerator *enumerator = [_fileManager enumeratorAtPath:_cacheBasePath];\n    NSMutableArray *requestIdentifersArr = [[NSMutableArray alloc] initWithCapacity:2];\n    \n    \n    for (NSString *fileName in enumerator){\n        \n        if ([fileName containsString:partialIdentifier]) {\n            \n            if ([fileName containsString:SJNetworkCacheFileSuffix]) {\n                \n                NSString *identifier = [fileName substringWithRange:NSMakeRange(0, (fileName.length - SJNetworkCacheFileSuffix.length - 1))];\n                [requestIdentifersArr addObject:identifier];\n                \n            }else{\n                //do not match cache data file\n            }\n        }\n    }\n    \n    if ([requestIdentifersArr count] > 0) {\n        NSMutableArray *cacheObjArr = [[NSMutableArray alloc] initWithCapacity:2];\n        \n        for (NSString* requestIdentifer in requestIdentifersArr) {\n            [self loadCacheWithRequestIdentifer:requestIdentifer completionBlock:^(id  _Nullable cacheObject) {\n                if (cacheObject) {\n                    [cacheObjArr addObject:cacheObject];\n                }\n            }];\n        }\n        \n        if (_isDebugMode) {\n            SJLog(@\"=========== Load cache succeed: Found cache corresponding this url\");\n        }\n        \n        dispatch_async(dispatch_get_main_queue(), ^{\n            if (completionBlock) {\n                completionBlock([cacheObjArr copy]);\n            }\n        });\n        \n        \n        \n    }else{\n        \n        if (_isDebugMode) {\n            SJLog(@\"=========== Load cache failed: There is no any cache corresponding this url\");\n        }\n        \n        dispatch_async(dispatch_get_main_queue(), ^{\n            if (completionBlock) {\n                completionBlock(nil);\n            }\n        });\n    }\n    \n}\n\n\n- (BOOL)p_checkCacheValidation:(SJNetworkCacheInfo *)cacheInfo{\n    \n    if (!cacheInfo || ![cacheInfo isKindOfClass:[SJNetworkCacheInfo class]]) {\n        return NO;\n    }\n    \n    //check duration\n    NSDate *creationDate = cacheInfo.creationDate;\n    NSTimeInterval pastDuration = - [creationDate timeIntervalSinceNow];\n    NSTimeInterval cacheDuration = [cacheInfo.cacheDuration integerValue];\n    \n    if (cacheDuration <= 0 ) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== Load cache info failed, reason: Did not set duration time, begin to clear cache...\");\n        }\n        [self p_clearCacheWithIdentifier:cacheInfo.reqeustIdentifer completionBlock:nil];\n        return NO;\n    }\n    \n    \n    if (pastDuration < 0 || pastDuration > cacheDuration) {\n        \n        if (_isDebugMode) {\n            SJLog(@\"=========== Load cache info failed, reason:Cache is expired, begin to clear cache...\");\n        }\n        \n        [self p_clearCacheWithIdentifier:cacheInfo.reqeustIdentifer completionBlock:nil];\n        return NO;\n    }\n    \n    \n    //check app version\n    NSString *cacheAppVersionStr = cacheInfo.appVersionStr;\n    NSString *currentAppVersionStr = [SJNetworkUtils appVersionStr];\n    \n    if ( (!cacheAppVersionStr) && (!currentAppVersionStr)) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== Load cache info failed, reason: Failed to load app version, begin to clear cache...\");\n        }\n        [self p_clearCacheWithIdentifier:cacheInfo.reqeustIdentifer completionBlock:nil];\n        return NO;\n    }\n    \n    if (cacheAppVersionStr.length != currentAppVersionStr.length || ![cacheAppVersionStr isEqualToString:currentAppVersionStr]) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== Load cache info failed, reason: Failed to match app version, begin to clear cache...\");\n        }\n        [self p_clearCacheWithIdentifier:cacheInfo.reqeustIdentifer completionBlock:nil];\n        return NO;\n    }\n    \n    return YES;\n    \n}\n\n\n\n- (void)p_clearCacheWithIdentifier:(NSString *)identifier completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock{\n    \n    \n    NSMutableArray *deleteFileNamesArr = [[NSMutableArray alloc] initWithCapacity:2];\n    NSDirectoryEnumerator *enumerator = [_fileManager enumeratorAtPath:_cacheBasePath];\n    \n    for (NSString *fileName in enumerator){\n        if ([fileName containsString:identifier]) {\n            NSString *deleteFilePath = [_cacheBasePath stringByAppendingPathComponent:fileName];\n            [deleteFileNamesArr addObject:deleteFilePath];\n        }\n    }\n    \n    if ([deleteFileNamesArr count] > 0) {\n        \n        for (NSInteger index = 0; index < deleteFileNamesArr.count; index++) {\n            \n            dispatch_async(sj_cache_io_queue(), ^{\n                \n                [_fileManager removeItemAtPath:deleteFileNamesArr[index] error:nil];\n                \n                if (index == deleteFileNamesArr.count - 1) {\n                    \n                    dispatch_async(dispatch_get_main_queue(), ^{\n                        if (_isDebugMode) {\n                            SJLog(@\"=========== Clearing cache successfully!\");\n                        }\n                        if (completionBlock) {\n                            completionBlock(YES);\n                            return;\n                        }\n                    });\n                }\n            });\n            \n        }\n        \n    }else{\n        \n        dispatch_async(dispatch_get_main_queue(), ^{\n            if (_isDebugMode) {\n                SJLog(@\"=========== Clearing cache error: there is no corresponding cache info\");\n            }\n            if (completionBlock) {\n                completionBlock(NO);\n                return;\n            }\n        });\n        \n    }\n    \n}\n\n\n\n- (id)p_loadCacheObjectWithCacheFilePath:(NSString *)cacheFilePath{\n    \n    id cacheObject = nil;\n    NSError *error = nil;\n    \n    if ([_fileManager fileExistsAtPath:cacheFilePath isDirectory:nil]) {\n        NSData *data = [NSData dataWithContentsOfFile:cacheFilePath];\n        cacheObject = [NSJSONSerialization JSONObjectWithData:data options:(NSJSONReadingOptions)0 error:&error];\n        if (cacheObject) {\n            return cacheObject;\n        }\n    }\n    return cacheObject;\n}\n\n\n\n- (SJNetworkCacheInfo *)p_loadCacheInfoWithRequestIdentifier:(NSString *)requestIdentifer {\n    \n    NSString *cacheInfoFilePath = [SJNetworkUtils cacheDataInfoFilePathWithRequestIdentifer:requestIdentifer];\n    \n    SJNetworkCacheInfo *cacheInfo = nil;\n    if ([_fileManager fileExistsAtPath:cacheInfoFilePath isDirectory:nil]) {\n        \n        cacheInfo = [NSKeyedUnarchiver unarchiveObjectWithFile:cacheInfoFilePath];\n        if ([cacheInfo isKindOfClass:[SJNetworkCacheInfo class]]) {\n            return cacheInfo;\n        }else{\n            return nil;\n        }\n    }\n    return nil;\n}\n\n\n@end\n"
  },
  {
    "path": "SJNetwork/SJNetworkConfig.h",
    "content": "//\n//  SJNetworkConfig.h\n//  SJNetwork\n//\n//  Created by Sun Shijie on 2017/8/16.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n\n/* =============================\n *\n * SJNetworkConfig\n *\n * SJNetworkConfig is in charge of the configuration of all related network requests\n *\n * =============================\n */\n\n@interface SJNetworkConfig : NSObject\n\n// Base url of requests, default is nil\n@property (nonatomic, strong) NSString *_Nullable baseUrl;\n\n// Default parameters, default is nil\n@property (nonatomic, strong) NSDictionary * _Nullable defailtParameters;\n\n// Custom headers, default is nil\n@property (nonatomic, readonly, strong) NSDictionary * _Nullable customHeaders;\n\n// Request timeout seconds, default is 20 (unit is second)\n@property (nonatomic, assign) NSTimeInterval timeoutSeconds;\n\n// If debugMode is set to be YES, then print all detail log\n@property (nonatomic, assign) BOOL debugMode;\n\n\n\n/**\n *  SJNetworkConfig Singleton\n *\n *  @return sharedConfig singleton instance\n */\n+ (SJNetworkConfig *_Nullable)sharedConfig;\n\n\n\n/**\n *  This method is used to add request headers (key-value pair(or pairs))\n *\n *  @param header               custom header to be added into request\n *\n */\n- (void)addCustomHeader:(NSDictionary *_Nonnull)header;\n\n\n@end\n"
  },
  {
    "path": "SJNetwork/SJNetworkConfig.m",
    "content": "//\n//  SJNetworkConfig.m\n//  SJNetwork\n//\n//  Created by Sun Shijie on 2017/8/16.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"SJNetworkConfig.h\"\n\n@interface SJNetworkConfig()\n\n@property (nonatomic, readwrite, strong) NSDictionary *customHeaders;\n\n@end\n\n@implementation SJNetworkConfig\n\n+ (SJNetworkConfig *)sharedConfig {\n    \n    static SJNetworkConfig *sharedInstance = nil;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        sharedInstance = [[self alloc] init];\n        sharedInstance.timeoutSeconds = 20;\n    });\n    return sharedInstance;\n}\n\n\n- (void)addCustomHeader:(NSDictionary *)header{\n    \n    if (![header isKindOfClass:[NSDictionary class]]) {\n        return;\n    }\n    \n    if ([[header allKeys] count] == 0) {\n        return;\n    }\n    \n    if (!_customHeaders) {\n         _customHeaders = header;\n        return;\n    }\n    \n    //add custom header\n    NSMutableDictionary *headers_m = [_customHeaders mutableCopy];\n    [header enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString *value, BOOL * _Nonnull stop) {\n        [headers_m setObject:value forKey:key];\n    }];\n    \n    _customHeaders = [headers_m copy];\n    \n}\n\n\n@end\n"
  },
  {
    "path": "SJNetwork/SJNetworkDownloadEngine.h",
    "content": "//\n//  SJNetworkDownloadManager.h\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/25.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n#import \"SJNetworkBaseEngine.h\"\n\n\n/* =============================\n *\n * SJNetworkDownloadEngine\n *\n * SJNetworkDownloadEngine is in charge of sending downloading requests.\n *\n * =============================\n */\n\n@interface SJNetworkDownloadEngine : SJNetworkBaseEngine\n\n\n//========================= Request API upload images ==========================//\n\n\n\n/**\n *  This method offers the most number of parameters of a certain download request.\n \n *  @note:\n *        1. All the other download file API will call this method.\n *\n *        2. If 'ignoreBaseUrl' is set to be YES, the base url which is holden by\n *           SJNetworkConfig will be ignored, so the 'url' will be the complete request\n *           url of this request.(default is set to be YES)\n *\n *        3. If 'resumable' is set to be YES, incomplete download data will be saved and\n *           when the same request is sent, the saved data will be used.(default is set to be YES)\n *\n *  @param url                      request url\n *  @param ignoreBaseUrl            consider whether to ignore configured base url\n *  @param downloadFilePath         target path of download file\n *  @param resumable                consider whether to save or load resumble data\n *  @param downloadProgressBlock    download progress callback\n *  @param downloadSuccessBlock     download success callback\n *  @param downloadFailureBlock     download failure callback\n *\n */\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n              ignoreBaseUrl:(BOOL)ignoreBaseUrl\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                  resumable:(BOOL)resumable\n          backgroundSupport:(BOOL)backgroundSupport\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock;\n\n\n\n\n\n/**\n *  This method is used to suspend all current download requests\n */\n- (void)suspendAllDownloadRequests;\n\n\n\n\n/**\n *  This method is used to suspend a download request with given url\n *\n *  @param url                   download url\n *\n */\n- (void)suspendDownloadRequest:(NSString * _Nonnull)url;\n\n\n\n\n/**\n *  This method is used to suspend a download request with given url which contains the baseUrl or not\n *\n *  @param url                   download url\n *  @param ignoreBaseUrl         ignore baseUrl or not\n *\n */\n- (void)suspendDownloadRequest:(NSString * _Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n\n/**\n *  This method is used to suspend one nor more download requests with given urls array\n *\n *  @param urls                   download url array\n *\n */\n- (void)suspendDownloadRequests:(NSArray *_Nonnull)urls;\n\n\n\n\n/**\n *  This method is used to suspend one nor more download requests with given urls which contain the baseUrl or not\n *\n *  @param urls                   download url array\n *  @param ignoreBaseUrl          ignore baseUrl or not\n *\n */\n- (void)suspendDownloadRequests:(NSArray *_Nonnull)urls ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n\n\n/**\n *  This method is used to resume all suspended download requests\n */\n- (void)resumeAllDownloadRequests;\n\n\n\n\n\n/**\n *  This method is used to resume a suspended request with given url\n *\n *  @param url                   download url\n *\n */\n- (void)resumeDownloadReqeust:(NSString *_Nonnull)url;\n\n\n\n\n/**\n *  This method is used to resume a suspended request with given url which contains the baseUrl or not\n *\n *  @param url                   download url\n *  @param ignoreBaseUrl         ignore baseUrl or not\n *\n */\n- (void)resumeDownloadReqeust:(NSString *_Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n\n/**\n *  This method is used to resume one nor more suspended requests with given urls array\n *\n *  @param urls                   download url array\n *\n */\n- (void)resumeDownloadReqeusts:(NSArray *_Nonnull)urls;\n\n\n\n\n/**\n *  This method is used to suspend one nor more suspended requests with given urls which contain the baseUrl or not\n *\n *  @param urls                   download url array\n *  @param ignoreBaseUrl          ignore baseUrl or not\n *\n */\n- (void)resumeDownloadReqeusts:(NSArray *_Nonnull)urls ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n\n\n/**\n *  This method is used to cancel all current download requests\n */\n- (void)cancelAllDownloadRequests;\n\n\n\n\n\n/**\n *  This method is used to cancel a current download request with given url\n *\n *  @param url                   download url\n *\n */\n- (void)cancelDownloadRequest:(NSString * _Nonnull)url;\n\n\n\n\n\n/**\n *  This method is used to cancel a current download request with given url which contains the baseUrl or not\n *\n *  @param url                   download url\n *  @param ignoreBaseUrl         ignore baseUrl or not\n *\n */\n- (void)cancelDownloadRequest:(NSString * _Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n\n\n/**\n *  This method is used to cancel one nor more current download requests with given urls array\n *\n *  @param urls                   download url array\n *\n */\n- (void)cancelDownloadRequests:(NSArray *_Nonnull)urls;\n\n\n\n\n/**\n *  This method is used to cancel one nor more current download requests with given urls which contain the baseUrl or not\n *\n *  @param urls                   download url array\n *  @param ignoreBaseUrl          ignore baseUrl or not\n *\n */\n- (void)cancelDownloadRequests:(NSArray *_Nonnull)urls ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n\n\n\n/**\n *  This method is used to get incomplete download data ratio of a download request with a given download url\n *\n *  @param url                    download url\n *\n *  @return incomplete download data ratio\n */\n- (CGFloat)resumeDataRatioOfRequest:(NSString *_Nonnull)url;\n\n\n\n\n\n/**\n *  This method is used to get incomplete download data ratio of a download request with a given download url which contains the baseUrl or not\n *\n *  @param url                    download url\n *  @param ignoreBaseUrl          ignore baseUrl or not\n *\n *  @return incomplete download data ratio\n */\n- (CGFloat)resumeDataRatioOfRequest:(NSString *_Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n@end\n"
  },
  {
    "path": "SJNetwork/SJNetworkDownloadEngine.m",
    "content": "//\n//  SJNetworkDownloadManager.m\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/25.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"SJNetworkDownloadEngine.h\"\n#import \"SJNetworkDownloadResumeDataInfo.h\"\n#import \"SJNetworkCacheManager.h\"\n#import \"SJNetworkRequestPool.h\"\n#import \"SJNetworkConfig.h\"\n#import \"SJNetworkUtils.h\"\n#import \"SJNetworkProtocol.h\"\n\n\n@interface SJNetworkDownloadEngine()<NSURLSessionDelegate,NSURLSessionDownloadDelegate,SJNetworkProtocol>\n\n@property (nonatomic, strong) NSURLSession *downloadSession;\n@property (nonatomic, strong) NSURLSession *backgroundDownloadSession;\n\n@property (nonatomic, strong) SJNetworkCacheManager *cacheManager;\n\n@end\n\n\n@implementation SJNetworkDownloadEngine\n{\n    NSFileManager *_fileManager;\n    BOOL _isDebugMode;\n}\n\n#pragma mark- ============== Life Cycle Methods ==============\n\n\n- (instancetype)init{\n    \n    self = [super init];\n    if (self) {\n        \n        //file  manager\n        _fileManager = [NSFileManager defaultManager];\n        \n        //debug mode\n        _isDebugMode = [SJNetworkConfig sharedConfig].debugMode;\n        \n        //cache manager\n        _cacheManager = [SJNetworkCacheManager sharedManager];\n    }\n    \n    return self;\n}\n\n\n- (void)dealloc{\n\n    [_backgroundDownloadSession invalidateAndCancel];\n    [_backgroundDownloadSession resetWithCompletionHandler:^{\n        \n    }];\n    \n    [_downloadSession invalidateAndCancel];\n    [_downloadSession resetWithCompletionHandler:^{\n        \n    }];\n    \n}\n\n\n#pragma mark- ============== Setter and Getter ==============\n\n- (NSURLSession *)downloadSession\n{\n    static NSURLSession *downloadSession = nil;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        NSURLSessionConfiguration* sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration];\n        sessionConfig.timeoutIntervalForRequest = [SJNetworkConfig sharedConfig].timeoutSeconds;\n        downloadSession = [NSURLSession sessionWithConfiguration:sessionConfig\n                                                        delegate:self\n                                                   delegateQueue:[NSOperationQueue mainQueue]];\n      \n \n    });\n    return downloadSession;\n    \n}\n\n\n\n- (NSURLSession *)backgroundDownloadSession\n{\n    static NSURLSession *backgroundDownloadSession = nil;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        NSString *identifier = @\"SJNetworkBackgroundSession\";\n        NSURLSessionConfiguration* sessionConfig = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:identifier];\n        sessionConfig.timeoutIntervalForRequest = [SJNetworkConfig sharedConfig].timeoutSeconds;\n        backgroundDownloadSession = [NSURLSession sessionWithConfiguration:sessionConfig\n                                                                  delegate:self\n                                                             delegateQueue:[NSOperationQueue mainQueue]];\n    });\n    return backgroundDownloadSession;\n    \n}\n\n\n#pragma mark- ============== Public Methods ==============\n\n#pragma mark ============== Download API ==============\n\n\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n              ignoreBaseUrl:(BOOL)ignoreBaseUrl\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                  resumable:(BOOL)resumable\n          backgroundSupport:(BOOL)backgroundSupport\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock{\n    \n    \n    //complete request url\n    NSString *completeUrlStr = nil;\n    \n    // a unique identifer of a download request\n    NSString *requestIdentifer = nil;\n    \n    if (ignoreBaseUrl) {\n        \n        completeUrlStr   = url;\n        requestIdentifer = [SJNetworkUtils generateDownloadRequestIdentiferWithBaseUrlStr:nil\n                                                                            requestUrlStr:url];\n    }else{\n        \n        completeUrlStr   = [[SJNetworkConfig sharedConfig].baseUrl stringByAppendingPathComponent:url];\n        requestIdentifer = [SJNetworkUtils generateDownloadRequestIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                            requestUrlStr:url];\n    }\n    \n    //Check if a download task with same download url exists\n    __block BOOL sameUrlTaskExists = NO;\n    if ([[SJNetworkRequestPool sharedPool] remainingCurrentRequests]) {\n        [[SJNetworkRequestPool sharedPool].currentRequestModels enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, SJNetworkRequestModel * _Nonnull requestModel, BOOL * _Nonnull stop) {\n            if ([requestModel.requestUrl isEqualToString:completeUrlStr]) {\n                sameUrlTaskExists = YES;\n                SJLog(@\"=========== Download request can not be started, since there is a task with the same download url:%@\",completeUrlStr);\n                return;\n            }\n        }];\n    }\n    if (sameUrlTaskExists) {\n        return;\n    }\n    \n    NSString *downloadTargetFilePath = nil;\n    BOOL isDirectory;\n    if(![[NSFileManager defaultManager] fileExistsAtPath:downloadFilePath isDirectory:&isDirectory]) {\n        isDirectory = NO;\n    }\n    \n    // If given downloadFilePath is a directory, then append it with file name to get downloadTargetFilePath(download file path)\n    if (isDirectory) {\n        NSString *fileName = [completeUrlStr lastPathComponent];\n        downloadTargetFilePath = [NSString pathWithComponents:@[downloadFilePath, fileName]];\n    } else {\n        downloadTargetFilePath = downloadFilePath;\n    }\n    \n    \n    \n    //remove same file in target download path\n    if ([_fileManager fileExistsAtPath:downloadTargetFilePath]) {\n        [_fileManager removeItemAtPath:downloadTargetFilePath error:nil];\n    }\n    \n    \n    \n    \n    //default method is GET\n    NSString *methodStr = @\"GET\";\n    \n    //create corresponding request model and send request with it\n    SJNetworkRequestModel *requestModel = [[SJNetworkRequestModel alloc] init];\n    requestModel.requestUrl = completeUrlStr;\n    requestModel.method = methodStr;\n    requestModel.requestIdentifer = requestIdentifer;\n    requestModel.downloadFilePath = downloadTargetFilePath;\n    requestModel.resumableDownload = resumable;\n    requestModel.backgroundDownloadSupport = backgroundSupport;\n    requestModel.manualOperation = SJDownloadManualOperationStart;\n    requestModel.downloadSuccessBlock = downloadSuccessBlock;\n    requestModel.downloadProgressBlock = downloadProgressBlock;\n    requestModel.downloadFailureBlock = downloadFailureBlock;\n    \n    NSURLSessionTask *downloadTask = nil;\n    \n    if (requestModel.backgroundDownloadSupport) {\n        \n        //downloadTask class : NSURLSessionDownloadTask\n        downloadTask = [self p_backgroundDownloadTaskWithRequestModel:requestModel];\n        \n    }else{\n        \n        //downloadTask class : NSURLSessionDataTask\n        downloadTask = [self p_noneBackgroundDownloadTaskWithRequestModel:requestModel];\n    }\n    \n    //keep task in request model\n    requestModel.task = downloadTask;\n    \n    //move this request model into requests set\n    [[SJNetworkRequestPool sharedPool] addRequestModel:requestModel];\n    \n    SJLog(@\"=========== start downloading:\\n =========== url:%@\\n =========== downloadPath:%@\",completeUrlStr,requestModel.downloadFilePath);\n    \n    \n    //start request\n    [downloadTask resume];\n    \n    \n}\n\n#pragma mark ============== Suspend API ==============\n\n\n- (void)suspendAllDownloadRequests{\n    \n    if(![[SJNetworkRequestPool sharedPool] remainingCurrentRequests]){\n        return;\n    }\n    \n    __block BOOL hasDownloadRequests = NO;\n    [[SJNetworkRequestPool sharedPool].currentRequestModels enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, SJNetworkRequestModel * _Nonnull requestModel, BOOL * _Nonnull stop) {\n        \n        if (requestModel.requestType == SJRequestTypeDownload) {\n            hasDownloadRequests = YES;\n            \n            if (requestModel.task) {\n                \n                if (requestModel.task.state == NSURLSessionTaskStateRunning) {\n                    \n                    if (requestModel.backgroundDownloadSupport) {\n                        \n                        requestModel.manualOperation = SJDownloadManualOperationSuspend;\n                        NSURLSessionDownloadTask *downloadTask = (NSURLSessionDownloadTask*)requestModel.task;\n                        [downloadTask cancelByProducingResumeData:^(NSData * _Nullable resumeData) {\n                        }];\n                        \n                    }else{\n                        \n                        [requestModel.task suspend];\n                        [_cacheManager updateResumeDataInfoAfterSuspendWithRequestModel:requestModel];\n                        SJLog(@\"=========== Suspended request:%@\",requestModel);\n                        \n                    }\n                    \n                    \n                }else {\n                    SJLog(@\"=========== Request %@ can not be suspended,since it is not running\",requestModel);\n                }\n                \n            }else {\n                SJLog(@\"=========== There is no donwload task of this request\");\n            }\n        }\n    }];\n    \n    if (!hasDownloadRequests) {\n        SJLog(@\"=========== There is no donwload task to suspend\");\n    }\n}\n\n\n\n- (void)suspendDownloadRequest:(NSString * _Nonnull)url;{\n    \n    if (url.length == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== The input url is an empty string!\");\n        }\n        return;\n    }\n    \n    if(![[SJNetworkRequestPool sharedPool] remainingCurrentRequests]){\n        return;\n    }\n    \n    //a unique identifer of a download request\n    NSString *downloadRequestIdentifier =  [SJNetworkUtils generateDownloadRequestIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                                            requestUrlStr:url];\n    [self p_suspendDownloadRequestWithDownloadRequestIdentifier:downloadRequestIdentifier];\n    \n}\n\n\n- (void)suspendDownloadRequest:(NSString * _Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n    \n    if (url.length == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== The input url is an empty string!\");\n        }\n        return;\n    }\n    \n    if(![[SJNetworkRequestPool sharedPool] remainingCurrentRequests]){\n        return;\n    }\n    \n    NSString *baseUrl = nil;\n    \n    if (!ignoreBaseUrl) {\n        baseUrl = [SJNetworkConfig sharedConfig].baseUrl;\n    }\n    \n    [self p_suspendDownloadRequestWithDownloadRequestIdentifier:[SJNetworkUtils generateDownloadRequestIdentiferWithBaseUrlStr:baseUrl requestUrlStr:url]];\n    \n}\n\n\n- (void)suspendDownloadRequests:(NSArray * _Nonnull)urls{\n    \n    \n    if ([urls count] == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== There is no input donwload urls!\");\n        }\n        return;\n    }\n    \n    if(![[SJNetworkRequestPool sharedPool] remainingCurrentRequests]){\n        return;\n    }\n    \n    [urls enumerateObjectsUsingBlock:^(NSString * url, NSUInteger idx, BOOL * _Nonnull stop) {\n        [self suspendDownloadRequest:url];\n    }];\n}\n\n\n- (void)suspendDownloadRequests:(NSArray *_Nonnull)urls ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n    if ([urls count] == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== There is no input donwload urls!\");\n        }\n        return;\n    }\n    \n    if(![[SJNetworkRequestPool sharedPool] remainingCurrentRequests]){\n        return;\n    }\n    \n    [urls enumerateObjectsUsingBlock:^(NSString * url, NSUInteger idx, BOOL * _Nonnull stop) {\n        [self suspendDownloadRequest:url ignoreBaseUrl:ignoreBaseUrl];\n    }];\n    \n}\n\n\n#pragma mark ============== Resume API ==============\n\n\n- (void)resumeAllDownloadRequests{\n    \n    __block BOOL hasDownloadRequests = NO;\n    \n    [[SJNetworkRequestPool sharedPool].currentRequestModels enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, SJNetworkRequestModel * _Nonnull requestModel, BOOL * _Nonnull stop) {\n        \n        \n        if (requestModel.requestType == SJRequestTypeDownload) {\n            \n            hasDownloadRequests = YES;\n            \n            if (requestModel.task) {\n                \n                if(requestModel.backgroundDownloadSupport){\n                    \n                    NSString *resumeDataFilePath = requestModel.resumeDataFilePath;\n                    \n                    if ([_fileManager fileExistsAtPath:resumeDataFilePath]) {\n                        NSData *resumeData = [NSData dataWithContentsOfFile:resumeDataFilePath];\n                        if (resumeData) {\n                            NSString *oldTaskKey = [NSString stringWithFormat:@\"%ld\",(unsigned long)requestModel.task.taskIdentifier];\n                            NSURLSessionTask * downloadTask = [self.backgroundDownloadSession downloadTaskWithResumeData:resumeData];\n                            requestModel.task = downloadTask;\n                            //change request model\n                            [[SJNetworkRequestPool sharedPool] changeRequestModel:requestModel forKey:oldTaskKey];\n                            [downloadTask resume];\n                            SJLog(@\"=========== Resumed background support download request: %@\",requestModel);\n                        }else{\n                            SJLog(@\"=========== Can not resume background support download request: %@, since resume data is not available\",requestModel);\n                        }\n                    }else{\n                        SJLog(@\"=========== Can not resume background support download request: %@, since there is no resume data in path %@\",requestModel,resumeDataFilePath);\n                    }\n                    \n                    \n                }else{\n                    if (requestModel.task.state == NSURLSessionTaskStateSuspended) {\n                        [requestModel.task resume];\n                        SJLog(@\"=========== Resumed request: %@\",requestModel);\n                    }else{\n                        SJLog(@\"=========== Can not resume request: %@, since it is not suspended\",requestModel);\n                    }\n                }\n                \n            }else {\n                SJLog(@\"=========== There is no download task of this request\");\n            }\n        }\n    }];\n    \n    if (!hasDownloadRequests) {\n        SJLog(@\"=========== There is no donwload task to resume\");\n    }\n    \n}\n\n- (void)resumeDownloadReqeust:(NSString *_Nonnull)url{\n    \n    \n    if (url.length == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== The input url is an empty string!\");\n        }\n        return;\n    }\n    \n    if(![[SJNetworkRequestPool sharedPool] remainingCurrentRequests]){\n        return;\n    }\n    \n    //a unique identifer of a download request\n    NSString *downloadRequestIdentifier =  [SJNetworkUtils generateDownloadRequestIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                                            requestUrlStr:url];\n    [self p_resumeDownloadRequestWithDownloadRequestIdentifier:downloadRequestIdentifier];\n    \n    \n}\n\n- (void)resumeDownloadReqeust:(NSString *_Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n    if (url.length == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== The input url is an empty string!\");\n        }\n        return;\n    }\n    if(![[SJNetworkRequestPool sharedPool] remainingCurrentRequests]){\n        return;\n    }\n    \n    NSString *baseUrl = nil;\n    \n    if (!ignoreBaseUrl) {\n        baseUrl = [SJNetworkConfig sharedConfig].baseUrl;\n    }\n    \n    //a unique identifer of a download request\n    NSString *downloadRequestIdentifier =  [SJNetworkUtils generateDownloadRequestIdentiferWithBaseUrlStr:baseUrl\n                                                                                            requestUrlStr:url];\n    [self p_resumeDownloadRequestWithDownloadRequestIdentifier:downloadRequestIdentifier];\n}\n\n\n- (void)resumeDownloadReqeusts:(NSArray *_Nonnull)urls{\n    \n    if ([urls count] == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== There is no input donwload urls!\");\n        }\n        return;\n    }\n    \n    if(![[SJNetworkRequestPool sharedPool] remainingCurrentRequests]){\n        return;\n    }\n    \n    [urls enumerateObjectsUsingBlock:^(NSString * url, NSUInteger idx, BOOL * _Nonnull stop) {\n        [self resumeDownloadReqeust:url];\n    }];\n    \n}\n\n- (void)resumeDownloadReqeusts:(NSArray *_Nonnull)urls ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n    if ([urls count] == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== There is no input donwload urls!\");\n        }\n        return;\n    }\n    \n    [urls enumerateObjectsUsingBlock:^(NSString * url, NSUInteger idx, BOOL * _Nonnull stop) {\n        [self resumeDownloadReqeust:url ignoreBaseUrl:ignoreBaseUrl];\n    }];\n    \n}\n\n\n\n\n#pragma mark ============== Cancel API ==============\n\n\n- (void)cancelAllDownloadRequests{\n    \n    if(![[SJNetworkRequestPool sharedPool] remainingCurrentRequests]){\n        return;\n    }\n    \n    __block BOOL hasDownloadRequests = NO;\n    [[SJNetworkRequestPool sharedPool].currentRequestModels enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, SJNetworkRequestModel * _Nonnull requestModel, BOOL * _Nonnull stop) {\n        \n        if (requestModel.requestType == SJRequestTypeDownload) {\n            \n            hasDownloadRequests = YES;\n            if (requestModel.task) {\n                \n                if (requestModel.backgroundDownloadSupport) {\n                    \n                    NSURLSessionDownloadTask *downloadTask = (NSURLSessionDownloadTask*)requestModel.task;\n                    requestModel.manualOperation = SJDownloadManualOperationCancel;\n                    [downloadTask cancelByProducingResumeData:^(NSData * _Nullable resumeData) {\n                    }];\n                    \n                }else{\n                    [requestModel.task cancel];\n                }\n                SJLog(@\"=========== Canceled request:%@\",requestModel);\n            }else {\n                SJLog(@\"=========== There is no donwload task of this request\");\n            }\n        }\n    }];\n    \n    if (!hasDownloadRequests) {\n        SJLog(@\"=========== There is no donwload task to cancel\");\n    }\n}\n\n\n\n\n- (void)cancelDownloadRequest:(NSString * _Nonnull)url{\n    \n    if (url.length == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== The input url is an empty string!\");\n        }\n        return;\n    }\n    \n    [[SJNetworkRequestPool sharedPool] cancelCurrentRequestWithUrl:url];\n}\n\n\n- (void)cancelDownloadRequest:(NSString * _Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n    if (url.length == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== The input url is an empty string!\");\n        }\n         return;\n    }\n    \n    \n    NSString *requestUrl = nil;\n    if (!ignoreBaseUrl) {\n        requestUrl = [[SJNetworkConfig sharedConfig].baseUrl stringByAppendingPathComponent:url];\n    }else{\n        requestUrl = url;\n    }\n    \n    [[SJNetworkRequestPool sharedPool] cancelCurrentRequestWithUrl:requestUrl];\n    \n    \n}\n\n\n- (void)cancelDownloadRequests:(NSArray *_Nonnull)urls{\n    \n    if ([urls count] == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== The input url array is empty!\");\n        }\n         return;\n    }\n    \n    [urls enumerateObjectsUsingBlock:^(NSString *url, NSUInteger idx, BOOL * _Nonnull stop) {\n        [[SJNetworkRequestPool sharedPool] cancelCurrentRequestWithUrl:url];\n    }];\n    \n}\n\n\n\n\n- (void)cancelDownloadRequests:(NSArray *_Nonnull)urls ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n    if ([urls count] == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== The input url array is empty!\");\n        }\n        return;\n    }\n    \n    [urls enumerateObjectsUsingBlock:^(NSString *url, NSUInteger idx, BOOL * _Nonnull stop) {\n        \n        NSString *requestUrl = nil;\n        if (!ignoreBaseUrl) {\n            requestUrl = [[SJNetworkConfig sharedConfig].baseUrl stringByAppendingPathComponent:url];\n        }else{\n            requestUrl = url;\n        }\n        [[SJNetworkRequestPool sharedPool] cancelCurrentRequestWithUrl:requestUrl];\n    }];\n}\n\n\n\n\n\n\n- (CGFloat)resumeDataRatioOfRequest:(NSString *_Nonnull)url{\n    \n    if (url.length == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== The input url is an empty string!\");\n        }\n        return 0.0;\n    }\n    \n    //a unique identifer of a download request\n    NSString *downloadRequestIdentifier =  [SJNetworkUtils generateDownloadRequestIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                                            requestUrlStr:url];\n    \n    return [self p_resumeDataRatioWithRequestIdentifier:downloadRequestIdentifier];\n    \n}\n\n\n\n\n- (CGFloat)resumeDataRatioOfRequest:(NSString *_Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n    if (url.length == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== The input url is an empty string!\");\n        }\n        return 0.0;\n    }\n    \n    NSString *baseUrl = nil;\n    \n    if (!ignoreBaseUrl) {\n        baseUrl = [SJNetworkConfig sharedConfig].baseUrl;\n    }\n    \n    //a unique identifer of a download request\n    NSString *downloadRequestIdentifier =  [SJNetworkUtils generateDownloadRequestIdentiferWithBaseUrlStr:baseUrl requestUrlStr:url];\n    \n    return [self p_resumeDataRatioWithRequestIdentifier:downloadRequestIdentifier];\n    \n}\n\n\n#pragma mark- ============== Private Methods ==============\n\n\n- (NSURLSessionTask *)p_backgroundDownloadTaskWithRequestModel:(SJNetworkRequestModel *)requestModel{\n    \n    \n    //init download request with request url\n    NSMutableURLRequest *downloadRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:requestModel.requestUrl]];\n    \n    //add custom header\n    [self p_addRequestHeaderInRequest:downloadRequest];\n   \n    \n    //temp download file\n    NSString *resumeDataFilePath = requestModel.resumeDataFilePath;\n    \n    NSString *resumeDataInfoFilePath = requestModel.resumeDataInfoFilePath;\n    \n    \n    if (![_fileManager fileExistsAtPath:resumeDataInfoFilePath]) {\n        SJNetworkDownloadResumeDataInfo  *dataInfo = [[SJNetworkDownloadResumeDataInfo alloc] init];\n        [NSKeyedArchiver archiveRootObject:dataInfo toFile:resumeDataInfoFilePath];\n    }\n    \n    NSURLSessionDownloadTask *downloadTask = nil;\n    \n    \n    if ([_fileManager fileExistsAtPath:resumeDataFilePath]) {\n        \n        \n        NSData *resumeData = [NSData dataWithContentsOfFile:resumeDataFilePath];\n        \n        if (resumeData) {\n            \n            if (requestModel.resumableDownload) {\n                downloadTask = [self.backgroundDownloadSession downloadTaskWithResumeData:resumeData];\n                \n            }else{\n                [_fileManager removeItemAtPath:resumeDataFilePath error:nil];\n                downloadTask = [self.backgroundDownloadSession downloadTaskWithRequest:downloadRequest];\n            }\n            \n        }else{\n            \n            [_fileManager removeItemAtPath:resumeDataFilePath error:nil];\n            downloadTask = [self.backgroundDownloadSession downloadTaskWithRequest:downloadRequest];\n        }\n        \n    }else{\n        \n        downloadTask = [self.backgroundDownloadSession downloadTaskWithRequest:downloadRequest];\n    }\n    \n    \n    \n    return downloadTask;\n}\n\n\n\n- (NSURLSessionTask *)p_noneBackgroundDownloadTaskWithRequestModel:(SJNetworkRequestModel *)requestModel{\n    \n    //init download request with request url\n    NSMutableURLRequest *downloadRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:requestModel.requestUrl]];\n    \n    //add custom header\n    [self p_addRequestHeaderInRequest:downloadRequest];\n    \n    \n    //temp download file\n    NSString *resumDataFilePath = requestModel.resumeDataFilePath;\n    \n    NSString *resumeDataInfoFilePath = requestModel.resumeDataInfoFilePath;\n    \n    \n    //create steam\n    NSOutputStream *stream = [NSOutputStream outputStreamToFileAtPath:resumDataFilePath append:YES];\n    requestModel.stream = stream;\n    \n    if (requestModel.resumableDownload) {\n        \n        if ([_fileManager fileExistsAtPath:resumeDataInfoFilePath] ) {\n            \n            //load resume data info\n            SJNetworkDownloadResumeDataInfo *dataInfo = [_cacheManager loadResumeDataInfo:resumeDataInfoFilePath];\n            \n            //check if resume data info exsists\n            if (dataInfo) {\n                \n                NSInteger resumeDataLength = [dataInfo.resumeDataLength integerValue];\n                if (resumeDataLength > 0) {\n                    NSString *range = [NSString stringWithFormat:@\"bytes=%zd-\", resumeDataLength];\n                    [downloadRequest setValue:range forHTTPHeaderField:@\"Range\"];\n                }\n                \n            }else{\n                \n                //if resume data info was not available and the corresponding data exists, then delete the corresponding data\n                if ([_fileManager fileExistsAtPath:resumDataFilePath]) {\n                    [_fileManager removeItemAtPath:resumeDataInfoFilePath error:nil];\n                }\n                \n            }\n        }else {\n            \n            //if this is a not a resumable download request and there is no resume data info, then create one\n            SJNetworkDownloadResumeDataInfo  *dataInfo = [[SJNetworkDownloadResumeDataInfo alloc] init];\n            [NSKeyedArchiver archiveRootObject:dataInfo toFile:resumeDataInfoFilePath];\n            \n            \n        }\n    }\n    \n    NSURLSessionDataTask *downloadTask = [self.downloadSession dataTaskWithRequest:downloadRequest];\n    return downloadTask;\n    \n}\n\n\n- (void)p_addRequestHeaderInRequest:(NSMutableURLRequest *)request{\n    \n    NSDictionary *customHeaders = [SJNetworkConfig sharedConfig].customHeaders;\n    if ([customHeaders allKeys] > 0) {\n        NSArray *allKeys = [customHeaders allKeys];\n        if ([allKeys count] >0) {\n            [customHeaders enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString *value, BOOL * _Nonnull stop) {\n                [request setValue:value forHTTPHeaderField:key];\n                if (_isDebugMode) {\n                    SJLog(@\"=========== added header:key:%@ value:%@\",key,value);\n                }\n            }];\n        }\n    }\n}\n\n\n- (void)p_suspendDownloadRequestWithDownloadRequestIdentifier:(NSString *)downloadRequestIdentifier{\n    \n    [[SJNetworkRequestPool sharedPool].currentRequestModels enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, SJNetworkRequestModel * _Nonnull requestModel, BOOL * _Nonnull stop) {\n        \n        if ([requestModel.requestIdentifer isEqualToString:downloadRequestIdentifier]) {\n            \n            if (requestModel.task) {\n                \n                if (requestModel.task.state == NSURLSessionTaskStateRunning) {\n                    \n                    if (requestModel.backgroundDownloadSupport) {\n                        \n                        requestModel.manualOperation = SJDownloadManualOperationSuspend;\n                        NSURLSessionDownloadTask *downloadTask = (NSURLSessionDownloadTask*)requestModel.task;\n                        [downloadTask cancelByProducingResumeData:^(NSData * _Nullable resumeData) {\n                        }];\n                        \n                    }else{\n                        \n                        [requestModel.task suspend];\n                        [_cacheManager updateResumeDataInfoAfterSuspendWithRequestModel:requestModel];\n                        SJLog(@\"=========== Suspended request:%@\",requestModel);\n                        \n                    }\n                    \n                }else {\n                    SJLog(@\"=========== Request %@ can not be suspended,since it is not running\",requestModel);\n                }\n                \n            }else {\n                SJLog(@\"=========== There is no donwload task of this request\");\n            }\n        }\n    }];\n    \n}\n\n- (void)p_resumeDownloadRequestWithDownloadRequestIdentifier:(NSString *)downloadRequestIdentifier{\n    \n    [[SJNetworkRequestPool sharedPool].currentRequestModels enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, SJNetworkRequestModel * _Nonnull requestModel, BOOL * _Nonnull stop) {\n        \n        if ([requestModel.requestIdentifer isEqualToString:downloadRequestIdentifier]) {\n            \n            if (requestModel.task) {\n                \n                if (requestModel.backgroundDownloadSupport) {\n                    \n                    if (requestModel.manualOperation == SJDownloadManualOperationSuspend) {\n                        \n                        NSString *resumeDataFilePath = requestModel.resumeDataFilePath;\n                        \n                        if ([_fileManager fileExistsAtPath:resumeDataFilePath]) {\n                            \n                            NSData *resumeData = [NSData dataWithContentsOfFile:resumeDataFilePath];\n                            if (resumeData) {\n                                \n                                NSString *oldTaskKey = [NSString stringWithFormat:@\"%ld\",(unsigned long)requestModel.task.taskIdentifier];\n                                NSURLSessionTask * downloadTask = [self.backgroundDownloadSession downloadTaskWithResumeData:resumeData];\n                                requestModel.manualOperation = SJDownloadManualOperationResume;\n                                requestModel.task = downloadTask;\n                                [[SJNetworkRequestPool sharedPool] changeRequestModel:requestModel forKey:oldTaskKey];\n                                [downloadTask resume];\n                                SJLog(@\"=========== Resumed background support download request: %@\",requestModel);\n                                \n                            }else{\n                                \n                                SJLog(@\"=========== Can not resume background support download request: %@, since resume data is not available\",requestModel);\n                                \n                            }\n                            \n                        }else{\n                            \n                            SJLog(@\"=========== Can not resume background support download request: %@, since there is no resume data in path %@\",requestModel,resumeDataFilePath);\n                        }\n                        \n                        \n                    }else{\n                        \n                        SJLog(@\"=========== Can not resume background support download request: %@, since it is not suspended(canceled) by user\",requestModel);\n                    }\n                    \n                }else{\n                    \n                    if (requestModel.task.state == NSURLSessionTaskStateSuspended) {\n                        [requestModel.task resume];\n                        SJLog(@\"=========== Resumed request: %@\",requestModel);\n                        \n                    }else{\n                        \n                        SJLog(@\"=========== Can not resume request: %@, since it is not suspended\",requestModel);\n                    }\n                }\n                \n            }else {\n                SJLog(@\"=========== There is no download task of this request\");\n            }\n        }\n    }];\n    \n}\n\n- (CGFloat)p_resumeDataRatioWithRequestIdentifier:(NSString *)requestIdentifier{\n    \n    NSString *resumeDataInfoFilePath = [SJNetworkUtils resumeDataInfoFilePathWithRequestIdentifer:requestIdentifier];\n    SJNetworkDownloadResumeDataInfo *dataInfo = [_cacheManager loadResumeDataInfo:resumeDataInfoFilePath];\n    \n    if (dataInfo) {\n        return [dataInfo.resumeDataRatio floatValue];\n    }else{\n        return 0.00;\n    }\n}\n\n\n#pragma mark- ============== SJNetworkProtocol ==============\n\n- (void)handleRequesFinished:(SJNetworkRequestModel *)requestModel{\n    \n    //clear all blocks\n    [requestModel clearAllBlocks];\n    \n    //remove this requst model from request queue\n    [[SJNetworkRequestPool sharedPool] removeRequestModel:requestModel];\n    \n}\n\n\n#pragma mark - ============== NSURLSessionTaskDelegate ==============\n\n- (void)URLSession:(NSURLSession *)session\n              task:(NSURLSessionTask *)task\ndidCompleteWithError:(NSError *)error{\n\n    if (_isDebugMode) {\n        SJLog(@\"=========== Download request did complete of task:%@\",task);\n    }\n\n    SJNetworkRequestModel * requestModel = [[SJNetworkRequestPool sharedPool].currentRequestModels objectForKey:[NSString stringWithFormat:@\"%ld\",(unsigned long)task.taskIdentifier]];\n\n    if (requestModel) {\n        \n        if (requestModel.backgroundDownloadSupport) {\n            \n            if (error) {\n                \n                //cancel request\n                if (error.code == -999) {\n                    \n                    [requestModel.task suspend];\n                    \n                    NSData *resumeData = requestModel.task.error.userInfo[NSURLSessionDownloadTaskResumeData];\n                    NSError *moveDownloadFileError = nil;\n                    \n                    if (requestModel.resumableDownload) {\n                        \n                        [resumeData writeToFile:requestModel.resumeDataFilePath options:NSDataWritingAtomic error:&moveDownloadFileError];\n                        \n                    }else{\n                        \n                        if (requestModel.manualOperation == SJDownloadManualOperationSuspend){\n                            \n                             [resumeData writeToFile:requestModel.resumeDataFilePath options:NSDataWritingAtomic error:&moveDownloadFileError];\n                            \n                        }else{\n                            \n                            if (_isDebugMode) {\n                                SJLog(@\"=========== Because this is not resumable downloading:\\n remove resume data in path:%@ \\n and resume data info in path:%@\",requestModel.resumeDataFilePath,requestModel.resumeDataInfoFilePath);\n                            }\n                            \n                            [_cacheManager removeResumeDataAndResumeDataInfoFileWithRequestModel:requestModel];\n                            \n                        }\n                        \n                       \n                        \n                    }\n                    \n                    if (requestModel.manualOperation == SJDownloadManualOperationSuspend) {\n                        \n                        SJLog(@\"=========== Suspended background support download request:%@\",requestModel);\n                        \n                    }else{\n                        \n                        SJLog(@\"=========== Canceled background support download request:%@\",requestModel);\n                        dispatch_async(dispatch_get_main_queue(), ^{\n                            if (requestModel.downloadFailureBlock) {\n                                    requestModel.downloadFailureBlock(requestModel.task, error,requestModel.resumeDataFilePath);\n                                \n                            }\n                            [self handleRequesFinished:requestModel];\n                       });\n                        \n                    }\n                    \n                    \n                }else{\n                    \n                    \n                    \n                    SJLog(@\"=========== Background support download failed, download file path:%@\",requestModel.downloadFilePath);\n                    \n                    dispatch_async(dispatch_get_main_queue(), ^{\n                        \n                        if (requestModel.downloadFailureBlock) {\n                                requestModel.downloadFailureBlock(requestModel.task, error,requestModel.resumeDataFilePath);\n                        }                        \n                        [self handleRequesFinished:requestModel];\n                    });\n                }\n                \n                \n            }else{\n                \n                \n                SJLog(@\"=========== Download succeed,download file path:%@\",requestModel.downloadFilePath);\n                 dispatch_async(dispatch_get_main_queue(), ^{\\\n                     \n                    if (requestModel.downloadSuccessBlock) {\n                        requestModel.downloadSuccessBlock(requestModel.downloadFilePath);\n                    }\n                    [self handleRequesFinished:requestModel];\n                     \n                });\n            }\n            \n            \n        }else {\n            \n            \n            if (error) {\n                \n                if (error.code == -997) {\n                    \n                    // The eror code equals to -997 means this app enters into background and then lost connect.\n                    // We offer an 'auto start request mechanism' to cope with this situation\n                   \n                    SJNetworkDownloadResumeDataInfo *dataInfo = [_cacheManager loadResumeDataInfo:requestModel.resumeDataInfoFilePath];\n                    NSDictionary *attributeDict = [_fileManager attributesOfItemAtPath:requestModel.resumeDataFilePath error:nil];\n                    NSInteger resumeDataLength = [attributeDict[NSFileSize] integerValue];\n                    dataInfo.resumeDataLength = [NSString stringWithFormat:@\"%ld\",(long)resumeDataLength];\n                    \n                    //ratio\n                    CGFloat ratio = 1.0 * ([dataInfo.resumeDataLength integerValue])/([dataInfo.totalDataLength integerValue]);\n                    dataInfo.resumeDataRatio = [NSString stringWithFormat:@\"%.2f\",ratio];\n                    [NSKeyedArchiver archiveRootObject:dataInfo toFile:requestModel.resumeDataInfoFilePath];\n                    \n                    \n                    [requestModel.stream close];\n                     requestModel.stream = nil;\n                    \n                    //lost connection background and the task is canceled\n                    NSString *oldTaskKey = [NSString stringWithFormat:@\"%ld\",(unsigned long)requestModel.task.taskIdentifier];\n                    //init download request with request url\n                    NSURLSessionTask * downloadTask = [self p_noneBackgroundDownloadTaskWithRequestModel:requestModel];\n                    requestModel.task = downloadTask;\n                    //change request model\n                    [[SJNetworkRequestPool sharedPool] changeRequestModel:requestModel forKey:oldTaskKey];\n                    [requestModel.task resume];\n                    \n                    \n                    \n                }else{\n                    \n                    if (requestModel.resumableDownload) {\n                        \n                        SJNetworkDownloadResumeDataInfo *dataInfo = [_cacheManager loadResumeDataInfo:requestModel.resumeDataInfoFilePath];\n                        NSDictionary *attributeDict = [_fileManager attributesOfItemAtPath:requestModel.resumeDataFilePath error:nil];\n                        NSInteger resumeDataLength = [attributeDict[NSFileSize] integerValue];\n                        dataInfo.resumeDataLength = [NSString stringWithFormat:@\"%ld\",(long)resumeDataLength];\n\n                        //ratio\n                        CGFloat ratio = 1.0 * ([dataInfo.resumeDataLength integerValue])/([dataInfo.totalDataLength integerValue]);\n                        dataInfo.resumeDataRatio = [NSString stringWithFormat:@\"%.2f\",ratio];\n                        [NSKeyedArchiver archiveRootObject:dataInfo toFile:requestModel.resumeDataInfoFilePath];\n                        \n                        \n                        if (_isDebugMode) {\n                            SJLog(@\"=========== Keep resume data in path:%@ \\n and save resume data info in path:%@, since this is a resumable donwloading\",requestModel.resumeDataFilePath,requestModel.resumeDataInfoFilePath);\n                        }\n                        \n                    }else {\n                        \n                        if (_isDebugMode) {\n                            SJLog(@\"=========== Remove resume data in path:%@ \\n and resume data info in path:%@, since this is not a resumable donwloading\",requestModel.resumeDataFilePath,requestModel.resumeDataInfoFilePath);\n                        }\n                        \n                        [_cacheManager removeResumeDataAndResumeDataInfoFileWithRequestModel:requestModel];\n                        \n                    }\n                    \n                    \n                    [requestModel.stream close];\n                     requestModel.stream = nil;\n                    \n                    \n                    SJLog(@\"=========== Download failed,download file path:%@\",requestModel.downloadFilePath);\n                    dispatch_async(dispatch_get_main_queue(), ^{\n                        \n                        if (requestModel.downloadFailureBlock) {\n                                requestModel.downloadFailureBlock(requestModel.task, error,requestModel.resumeDataFilePath);\n                        }\n                        [self handleRequesFinished:requestModel];\n                    });\n                    \n                }\n                \n            }else {\n                \n                //download succeed\n                [_cacheManager removeCompleteDownloadDataAndClearResumeDataInfoFileWithRequestModel:requestModel];\n                \n                [requestModel.stream close];\n                 requestModel.stream = nil;\n                \n                SJLog(@\"=========== Download succeed,download file path:%@\",requestModel.downloadFilePath);\n                dispatch_async(dispatch_get_main_queue(), ^{\n                    \n                    if (requestModel.downloadSuccessBlock) {\n                        requestModel.downloadSuccessBlock(requestModel.downloadFilePath);\n                    }\n                    [self handleRequesFinished:requestModel];\n                });\n            }\n        }\n    }\n}\n\n\n\n- (void)URLSession:(NSURLSession *)session\n          dataTask:(NSURLSessionDataTask *)dataTask\ndidReceiveResponse:(NSHTTPURLResponse *)response\n completionHandler:(void (^)(NSURLSessionResponseDisposition))completionHandler{\n\n    if (_isDebugMode) {\n        SJLog(@\"=========== Did received response:%@ \\n of task:%@\",response,dataTask);\n    }\n\n    SJNetworkRequestModel * requestModel = [[SJNetworkRequestPool sharedPool].currentRequestModels objectForKey:[NSString stringWithFormat:@\"%ld\",(unsigned long)dataTask.taskIdentifier]];\n\n    if (requestModel) {\n        \n        \n        \n        NSInteger statusCode  = 0;\n        if ([dataTask.response isKindOfClass:[NSHTTPURLResponse class]]) {\n            statusCode = [(NSHTTPURLResponse*)dataTask.response statusCode];\n        }\n        \n        NSString *resumeDataInfoFilePath = requestModel.resumeDataInfoFilePath;\n        NSString *resumeDataFilePath= requestModel.resumeDataFilePath;\n        \n        if (statusCode > 400) {\n            \n            NSError *error = [NSError errorWithDomain:@\"request error\" code:statusCode userInfo:nil];\n            \n            [_fileManager removeItemAtPath:resumeDataInfoFilePath error:nil];\n            \n            if ([_fileManager fileExistsAtPath:resumeDataFilePath]) {\n                [_fileManager removeItemAtPath:resumeDataFilePath error:nil];\n            }\n            \n            \n            SJLog(@\"=========== Download failed,download file path:%@\",requestModel.downloadFilePath);\n            dispatch_async(dispatch_get_main_queue(), ^{\n                \n                if (requestModel.downloadFailureBlock) {\n                    requestModel.downloadFailureBlock(requestModel.task, error,nil);\n                }\n                [self handleRequesFinished:requestModel];\n            });\n            \n            return;\n            \n        }\n        \n        //no error, open stream\n        [requestModel.stream open];\n\n        //load resume data info\n        SJNetworkDownloadResumeDataInfo *dataInfo = [_cacheManager loadResumeDataInfo:requestModel.resumeDataInfoFilePath];\n        if (!dataInfo) {\n            dataInfo = [[SJNetworkDownloadResumeDataInfo alloc] init];\n        }\n\n        //resume data file length\n        NSDictionary *attributeDict = [_fileManager attributesOfItemAtPath:resumeDataFilePath error:nil];\n        NSInteger resumeDataLength = [attributeDict[NSFileSize] integerValue];\n        dataInfo.resumeDataLength = [NSString stringWithFormat:@\"%ld\",(long)resumeDataLength];\n\n        //total data file length\n        NSInteger totalLength = [response.allHeaderFields[@\"Content-Length\"] integerValue] + [dataInfo.resumeDataLength integerValue];\n        dataInfo.totalDataLength = [NSString stringWithFormat:@\"%ld\",(long)totalLength];\n        requestModel.totalLength = totalLength;\n\n        //ratio\n        CGFloat ratio = 1.0 * ([dataInfo.resumeDataLength integerValue])/([dataInfo.totalDataLength integerValue]);\n        dataInfo.resumeDataRatio = [NSString stringWithFormat:@\"%.2f\",ratio];\n\n        [NSKeyedArchiver archiveRootObject:dataInfo toFile:requestModel.resumeDataInfoFilePath];\n\n        completionHandler(NSURLSessionResponseAllow);\n\n    }\n}\n\n\n- (void)URLSession:(NSURLSession *)session\n          dataTask:(NSURLSessionDataTask *)dataTask\n    didReceiveData:(NSData *)data\n{\n\n    SJNetworkRequestModel * requestModel = [[SJNetworkRequestPool sharedPool].currentRequestModels objectForKey:[NSString stringWithFormat:@\"%ld\",(unsigned long)dataTask.taskIdentifier]];\n\n    if (requestModel) {\n\n        //write data in stream\n        [requestModel.stream write:data.bytes maxLength:data.length];\n\n        //update resume data info\n        SJNetworkDownloadResumeDataInfo *dataInfo = [_cacheManager loadResumeDataInfo: requestModel.resumeDataInfoFilePath];\n        NSDictionary *attributeDict = [_fileManager attributesOfItemAtPath:requestModel.resumeDataFilePath error:nil];\n        NSInteger resumeDataLength = [attributeDict[NSFileSize] integerValue];\n        dataInfo.resumeDataLength = [NSString stringWithFormat:@\"%ld\",(long)resumeDataLength];\n        \n        CGFloat ratio = 1.0 * ([dataInfo.resumeDataLength integerValue])/([dataInfo.totalDataLength integerValue]);\n        dataInfo.resumeDataRatio = [NSString stringWithFormat:@\"%.2f\",ratio];\n        [NSKeyedArchiver archiveRootObject:dataInfo toFile:requestModel.resumeDataInfoFilePath];\n\n        if (_isDebugMode) {\n            SJLog(@\"=========== Download progress:%@ of task:%@\",dataInfo.resumeDataRatio,requestModel.task);\n        }\n        if (requestModel.downloadProgressBlock) {\n            requestModel.downloadProgressBlock([dataInfo.resumeDataLength integerValue] ,requestModel.totalLength,ratio);\n        }\n\n    }\n}\n\n\n#pragma mark - ==============  NSURLSessionDownloadDelegate ==============\n\n\n\n\n- (void)URLSession:(NSURLSession *)session\n      downloadTask:(NSURLSessionDownloadTask *)downloadTask\ndidFinishDownloadingToURL:(NSURL *)location\n{\n    \n    SJNetworkRequestModel * requestModel = [[SJNetworkRequestPool sharedPool].currentRequestModels objectForKey:[NSString stringWithFormat:@\"%ld\",(unsigned long)downloadTask.taskIdentifier]];\n    \n    \n    if (requestModel) {\n        \n        \n        NSInteger statusCode  = 0;\n        if ([downloadTask.response isKindOfClass:[NSHTTPURLResponse class]]) {\n            statusCode = [(NSHTTPURLResponse*)downloadTask.response statusCode];\n        }\n                \n        NSString *resumeDataInfoFilePath = requestModel.resumeDataInfoFilePath;\n        NSString *resumeDataFilePath= requestModel.resumeDataFilePath;\n        \n        if (statusCode > 400) {\n            \n            NSError *error = nil;\n            if (statusCode == 416) {\n                error = [NSError errorWithDomain:@\"range error\" code:statusCode userInfo:nil];\n            }\n            \n            [_fileManager removeItemAtPath:resumeDataInfoFilePath error:nil];\n            \n            if ([_fileManager fileExistsAtPath:resumeDataFilePath]) {\n                [_fileManager removeItemAtPath:resumeDataFilePath error:nil];\n            }\n            \n            \n            SJLog(@\"=========== Download failed,download file path:%@\",requestModel.downloadFilePath);\n            dispatch_async(dispatch_get_main_queue(), ^{\n                \n                if (requestModel.downloadFailureBlock) {\n                    requestModel.downloadFailureBlock(requestModel.task, error,nil);\n                }\n                [self handleRequesFinished:requestModel];\n            });\n            \n        }else{\n        \n                \n            NSData *tmpDownloadFileData = [NSData dataWithContentsOfURL:location];\n            NSUInteger downloadDataLength = tmpDownloadFileData.length;\n        \n        \n            //download succeed\n            NSError *moveDownloadFileError = nil;\n            \n            //move temp download data to target file path\n            [_fileManager moveItemAtURL:location toURL:[NSURL fileURLWithPath:requestModel.downloadFilePath] error:&moveDownloadFileError];\n            \n            //remove data info file path\n            [_fileManager removeItemAtPath:resumeDataInfoFilePath error:nil];\n            \n            if ([_fileManager fileExistsAtPath:resumeDataFilePath]) {\n                [_fileManager removeItemAtPath:resumeDataFilePath error:nil];\n            }\n            \n            if (moveDownloadFileError &&  moveDownloadFileError.code != 516) {\n                \n                SJLog(@\"=========== Download failed,download file path:%@\",requestModel.downloadFilePath);\n                \n                 dispatch_async(dispatch_get_main_queue(), ^{\n                     \n                    if (requestModel.downloadFailureBlock) {\n                            requestModel.downloadFailureBlock(requestModel.task, moveDownloadFileError,nil);\n                    }\n                     \n                    [self handleRequesFinished:requestModel];\n                 });\n                \n            }else {\n                \n                if (requestModel.downloadProgressBlock) {\n                    requestModel.downloadProgressBlock(downloadDataLength, downloadDataLength, 1);\n                }\n                \n                if (moveDownloadFileError.code == 516) {\n                    [_fileManager removeItemAtPath:location.absoluteString error:nil];\n                }\n                \n                //succeed block\n                SJLog(@\"=========== Download succeed,download file path:%@\",requestModel.downloadFilePath);\n                dispatch_async(dispatch_get_main_queue(), ^{\n                    \n                    if (requestModel.downloadSuccessBlock) {\n                        requestModel.downloadSuccessBlock(requestModel.downloadFilePath);\n                    }\n                    [self handleRequesFinished:requestModel];\n                });\n            }\n            }\n        }\n}\n\n\n\n- (void)URLSession:(NSURLSession *)session\n      downloadTask:(NSURLSessionDownloadTask *)downloadTask\n      didWriteData:(int64_t)bytesWritten\n totalBytesWritten:(int64_t)totalBytesWritten\ntotalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite\n{\n    \n    SJNetworkRequestModel * requestModel = [[SJNetworkRequestPool sharedPool].currentRequestModels objectForKey:[NSString stringWithFormat:@\"%ld\",(unsigned long)downloadTask.taskIdentifier]];\n    \n    if (requestModel) {\n        \n        if (!requestModel.totalLength) {\n             requestModel.totalLength = (NSInteger)totalBytesExpectedToWrite;\n        }\n        \n        CGFloat ratio = 1.0 *totalBytesWritten/requestModel.totalLength;\n        NSString *resumeDataInfoFilePath = requestModel.resumeDataInfoFilePath;\n        SJNetworkDownloadResumeDataInfo *dataInfo = [_cacheManager loadResumeDataInfo:resumeDataInfoFilePath];\n        \n        dataInfo.resumeDataLength = [NSString stringWithFormat:@\"%lld\",totalBytesWritten];\n        dataInfo.totalDataLength = [NSString stringWithFormat:@\"%ld\",(long)requestModel.totalLength];\n        dataInfo.resumeDataRatio = [NSString stringWithFormat:@\"%.2f\",ratio];\n\n        [NSKeyedArchiver archiveRootObject:dataInfo toFile:resumeDataInfoFilePath];\n        \n        if (_isDebugMode) {\n            SJLog(@\"=========== Download progress:%@ of task:%@\",dataInfo.resumeDataRatio,requestModel.task);\n        }\n        if (requestModel.downloadProgressBlock) {\n            requestModel.downloadProgressBlock((NSInteger)bytesWritten ,requestModel.totalLength,ratio);\n        }\n    }\n    \n    \n}\n\n\n\n@end\n"
  },
  {
    "path": "SJNetwork/SJNetworkDownloadResumeDataInfo.h",
    "content": "//\n//  SJNetworkResumeDataInfo.h\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/28.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n\n\n/* =============================\n *\n * SJNetworkDownloadResumeDataInfo\n *\n * SJNetworkDownloadResumeDataInfo is in charge of recording the infomation of resume data of the corresponding download request\n *\n * =============================\n */\n\n@interface SJNetworkDownloadResumeDataInfo : NSObject<NSSecureCoding>\n\n// Record the resume data length\n@property (nonatomic, readwrite, copy) NSString *resumeDataLength;\n\n// Record total length of the download data\n@property (nonatomic, readwrite, copy) NSString *totalDataLength;\n\n// Record the ratio of resume data length and total length of download data (resumeDataLength/dataTotalLength)\n@property (nonatomic, readwrite, copy) NSString *resumeDataRatio;\n\n\n@end\n\n"
  },
  {
    "path": "SJNetwork/SJNetworkDownloadResumeDataInfo.m",
    "content": "//\n//  SJNetworkResumeDataInfo.m\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/28.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"SJNetworkDownloadResumeDataInfo.h\"\n\n@implementation SJNetworkDownloadResumeDataInfo\n\n#pragma mark- ============== Life Cycle Methods ==============\n\n- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder {\n    \n    self = [self init];\n    \n    if (self) {\n        \n        self.resumeDataRatio = [aDecoder decodeObjectOfClass:[NSString class] forKey:NSStringFromSelector(@selector(resumeDataRatio))];\n        self.resumeDataLength = [aDecoder decodeObjectOfClass:[NSString class] forKey:NSStringFromSelector(@selector(resumeDataLength))];\n        self.totalDataLength = [aDecoder decodeObjectOfClass:[NSString class] forKey:NSStringFromSelector(@selector(totalDataLength))];\n    }    \n    return self;\n}\n\n#pragma mark- ============== Override Methods ==============\n\n+ (BOOL)supportsSecureCoding {\n    \n    return YES;\n}\n\n- (void)encodeWithCoder:(NSCoder *)aCoder{\n    \n    [aCoder encodeObject:self.resumeDataLength forKey:NSStringFromSelector(@selector(resumeDataLength))];\n    [aCoder encodeObject:self.totalDataLength forKey:NSStringFromSelector(@selector(totalDataLength))];\n    [aCoder encodeObject:self.resumeDataRatio forKey:NSStringFromSelector(@selector(resumeDataRatio))];\n}\n\n\n\n- (NSString *)description{\n    \n    return [NSString stringWithFormat:@\"<%@: %p>:{resume data length:%@}, {total data length:%@},{ratio:%@}\",NSStringFromClass([self class]), self,_resumeDataLength, _totalDataLength, _resumeDataRatio];\n}\n\n@end\n"
  },
  {
    "path": "SJNetwork/SJNetworkHeader.h",
    "content": "//\n//  SJNetworkHeader.h\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/12/26.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#ifndef SJNetworkHeader_h\n#define SJNetworkHeader_h\n\n#import <AFNetworking/AFNetworking.h>\n\n//Log used to debug\n#ifdef DEBUG\n#define SJLog(...) NSLog(@\"%s line number:%d \\n %@\\n\\n\",__func__,__LINE__,[NSString stringWithFormat:__VA_ARGS__])\n#else\n#define SJLog(...)\n#endif\n\n\n//============== Callbacks: Only for ordinary request ==================//\ntypedef void(^SJSuccessBlock)(id responseObject);\ntypedef void(^SJFailureBlock)(NSURLSessionTask *task, NSError *error, NSInteger statusCode);\n\n\n//============== Callbacks: Only for upload request ==================//\ntypedef void(^SJUploadSuccessBlock)(id responseObject);\ntypedef void(^SJUploadProgressBlock)(NSProgress *uploadProgress);\ntypedef void(^SJUploadFailureBlock)(NSURLSessionTask *task, NSError *error, NSInteger statusCode, NSArray<UIImage *>*uploadFailedImages);\n\n\n//============== Callbacks: Only for download request ==================//\ntypedef void(^SJDownloadSuccessBlock)(id responseObject);\ntypedef void(^SJDownloadProgressBlock)(NSInteger receivedSize, NSInteger expectedSize, CGFloat progress);\ntypedef void(^SJDownloadFailureBlock)(NSURLSessionTask *task, NSError *error, NSString* resumableDataPath);\n\n\n/**\n *  HTTP Request method\n */\ntypedef NS_ENUM(NSInteger, SJRequestMethod) {\n    \n    SJRequestMethodGET = 60000,\n    SJRequestMethodPOST,\n    SJRequestMethodPUT,\n    SJRequestMethodDELETE,\n    \n};\n\n\n/**\n *  Request type\n */\ntypedef NS_ENUM(NSInteger, SJRequestType) {\n    \n    SJRequestTypeOrdinary = 70000,\n    SJRequestTypeUpload,\n    SJRequestTypeDownload\n    \n};\n\n\n/**\n *  Manual operation by user (start,suspend,resume,cancel)\n */\ntypedef NS_ENUM(NSInteger, SJDownloadManualOperation) {\n    \n    SJDownloadManualOperationStart = 80000,\n    SJDownloadManualOperationSuspend,\n    SJDownloadManualOperationResume,\n    SJDownloadManualOperationCancel,\n    \n};\n\n\n#endif /* SJNetworkHeader_h */\n"
  },
  {
    "path": "SJNetwork/SJNetworkManager.h",
    "content": "//\n//  SJNetworkManager.h\n//  SJNetwork\n//\n//  Created by Sun Shijie on 2017/8/16.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n#import <UIKit/UIKit.h>\n\n#import \"SJNetworkRequestModel.h\"\n#import \"SJNetworkCacheManager.h\"\n\n\n/* =============================\n *\n * SJNetworkManager\n *\n * SJNetworkManager is in charge of managing operations of network request\n *\n * =============================\n */\n\n@interface SJNetworkManager : NSObject\n\n\n/**\n *  SJNetworkManager Singleton\n *\n *  @return SJNetworkManager singleton instance\n */\n+ (SJNetworkManager *_Nullable)sharedManager;\n\n\n\n/**\n *  can not use new method\n */\n+ (instancetype _Nullable)new NS_UNAVAILABLE;\n\n\n\n/**\n *  This method is used to add custom header\n *\n *  @param header            custom header added by user\n *\n */\n- (void)addCustomHeader:(NSDictionary *_Nonnull)header;\n\n\n\n/**\n *  This method is used to return custom header\n *\n *  @return custom header\n */\n- (NSDictionary *_Nullable)customHeaders;\n\n\n#pragma mark- Request API using GET method\n\n/**\n *  This method is used to send GET request,\n not consider whether to write cache & not consider whether to load cache\n *\n *  @param url                 request url\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendGetRequest:(NSString * _Nonnull)url\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n\n/**\n *  This method is used to send GET request,\n not consider whether to write cache & not consider whether to load cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendGetRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n/**\n *  This method is used to send GET request,\n consider whether to load cache but not consider whether to write cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param loadCache           consider whether to load cache\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendGetRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n             loadCache:(BOOL)loadCache\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n/**\n *  This method is used to send GET request,\n consider whether to write cache but not consider whether to load cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param cacheDuration       consider whether to write cache\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendGetRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n         cacheDuration:(NSTimeInterval)cacheDuration\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n/**\n *  This method is used to send GET request,\n consider whether to load cache and consider whether to write cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param loadCache           consider whether to load cache\n *  @param cacheDuration       consider whether to write cache\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendGetRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n             loadCache:(BOOL)loadCache\n         cacheDuration:(NSTimeInterval)cacheDuration\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n#pragma mark- Request API using POST method\n\n/**\n *  This method is used to send POST request,\n not consider whether to write cache & not consider whether to load cache\n *\n *  @param url                request url\n *  @param parameters         parameters\n *  @param successBlock       success callback\n *  @param failureBlock       failure callback\n *\n */\n- (void)sendPostRequest:(NSString * _Nonnull)url\n             parameters:(id _Nullable)parameters\n                success:(SJSuccessBlock _Nullable)successBlock\n                failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n/**\n *  This method is used to send POST request,\n consider whether to load cache but not consider whether to write cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param loadCache           consider whether to load cache\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendPostRequest:(NSString * _Nonnull)url\n             parameters:(id _Nullable)parameters\n              loadCache:(BOOL)loadCache\n                success:(SJSuccessBlock _Nullable)successBlock\n                failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n/**\n *  This method is used to send POST request,\n consider whether to write cache but not consider whether to load cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param cacheDuration       consider whether to write cache\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendPostRequest:(NSString * _Nonnull)url\n             parameters:(id _Nullable)parameters\n          cacheDuration:(NSTimeInterval)cacheDuration\n                success:(SJSuccessBlock _Nullable)successBlock\n                failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n/**\n *  This method is used to send POST request,\n consider whether to load cache and consider whether to write cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param loadCache           consider whether to load cache\n *  @param cacheDuration       consider whether to write cache\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendPostRequest:(NSString * _Nonnull)url\n             parameters:(id _Nullable)parameters\n              loadCache:(BOOL)loadCache\n          cacheDuration:(NSTimeInterval)cacheDuration\n                success:(SJSuccessBlock _Nullable)successBlock\n                failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n#pragma mark- Request API using PUT method\n\n\n/**\n *  This method is used to send PUT request,\n not consider whether to write cache & not consider whether to load cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendPutRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n/**\n *  This method is used to send POST request,\n consider whether to load cache but not consider whether to write cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param loadCache           consider whether to load cache\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendPutRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n             loadCache:(BOOL)loadCache\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n/**\n *  This method is used to send POST request,\n consider whether to write cache but not consider whether to load cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param cacheDuration       consider whether to write cache\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendPutRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n         cacheDuration:(NSTimeInterval)cacheDuration\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n/**\n *  This method is used to send POST request,\n consider whether to load cache and consider whether to write cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param loadCache           consider whether to load cache\n *  @param cacheDuration       consider whether to write cache\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendPutRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n             loadCache:(BOOL)loadCache\n         cacheDuration:(NSTimeInterval)cacheDuration\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n#pragma mark- Request API using DELETE method\n\n/**\n *  This method is used to send DELETE request,\n not consider whether to write cache & not consider whether to load cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendDeleteRequest:(NSString * _Nonnull)url\n               parameters:(id _Nullable)parameters\n                  success:(SJSuccessBlock _Nullable)successBlock\n                  failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n/**\n *  This method is used to send POST request,\n consider whether to load cache but not consider whether to write cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param loadCache           consider whether to load cache\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendDeleteRequest:(NSString * _Nonnull)url\n               parameters:(id _Nullable)parameters\n                loadCache:(BOOL)loadCache\n                  success:(SJSuccessBlock _Nullable)successBlock\n                  failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n/**\n *  This method is used to send POST request,\n consider whether to write cache but not consider whether to load cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param cacheDuration       consider whether to write cache\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendDeleteRequest:(NSString * _Nonnull)url\n               parameters:(id _Nullable)parameters\n            cacheDuration:(NSTimeInterval)cacheDuration\n                  success:(SJSuccessBlock _Nullable)successBlock\n                  failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n/**\n *  This method is used to send POST request,\n consider whether to load cache and consider whether to write cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param loadCache           consider whether to load cache\n *  @param cacheDuration       consider whether to write cache\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendDeleteRequest:(NSString * _Nonnull)url\n               parameters:(id _Nullable)parameters\n                loadCache:(BOOL)loadCache\n            cacheDuration:(NSTimeInterval)cacheDuration\n                  success:(SJSuccessBlock _Nullable)successBlock\n                  failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n#pragma mark- Request API using specific parameters\n\n/**\n *  These methods are used to send request with specific parameters:\n \n 1. if the parameters object is nil,then send GET request\n 2. if the parameters object is not nil,then send POST request\n */\n\n\n/**\n *  This method is used to send request with specific parameters,\n not consider whether to write cache & not consider whether to load cache\n *\n *  @param url                request url\n *  @param parameters         parameters\n *  @param successBlock       success callback\n *  @param failureBlock       failure callback\n *\n */\n- (void)sendRequest:(NSString * _Nonnull)url\n         parameters:(id _Nullable)parameters\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n/**\n *  This method is used to send request with specific parameters,\n not consider whether to write cache but consider whether to load cache\n \n *\n *  @param url                request url\n *  @param parameters         parameters\n *  @param loadCache          consider whether to load cache\n *  @param successBlock       success callback\n *  @param failureBlock       failure callback\n *\n */\n- (void)sendRequest:(NSString * _Nonnull)url\n         parameters:(id _Nullable)parameters\n          loadCache:(BOOL)loadCache\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n/**\n * This method is used to send request with specific parameters,\n not consider whether to load cache but consider whether to write cache\n \n *\n *  @param url                request url\n *  @param parameters         parameters\n *  @param cacheDuration      consider whether to write cache\n *  @param successBlock       success callback\n *  @param failureBlock       failure callback\n *\n */\n- (void)sendRequest:(NSString * _Nonnull)url\n         parameters:(id _Nullable)parameters\n      cacheDuration:(NSTimeInterval)cacheDuration\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n/**\n *  This method is used to send request with specific parameters,\n consider whether to load cache and consider whether to write cache\n \n *\n *  @param url                request url\n *  @param parameters         parameters\n *  @param loadCache          consider whether to load cache\n *  @param cacheDuration      consider whether to write cache\n *  @param successBlock       success callback\n *  @param failureBlock       failure callback\n *\n */\n- (void)sendRequest:(NSString * _Nonnull)url\n         parameters:(id _Nullable)parameters\n          loadCache:(BOOL)loadCache\n      cacheDuration:(NSTimeInterval)cacheDuration\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n\n//================== Request API using specific request method ==================//\n\n\n/**\n *  This method is used to send request with specific method(GET,POST,PUT,DELETE),\n *  not consider whether to write cache & not consider whether to load cache\n *\n *  @param url                 request url\n *  @param method              request method\n *  @param parameters          parameters\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendRequest:(NSString * _Nonnull)url\n             method:(SJRequestMethod)method\n         parameters:(id _Nullable)parameters\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n\n/**\n *  This method is used to send request with specific method(GET,POST,PUT,DELETE),\n *  not consider whether to write cache but consider whether to load cache\n *\n *  @param url                request url\n *  @param method             request method\n *  @param parameters         parameters\n *  @param loadCache          consider whether to load cache\n *  @param successBlock       success callback\n *  @param failureBlock       failure callback\n *\n */\n- (void)sendRequest:(NSString * _Nonnull)url\n             method:(SJRequestMethod)method\n         parameters:(id _Nullable)parameters\n          loadCache:(BOOL)loadCache\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n\n\n\n/**\n *  This method is used to send request with specific method(GET,POST,PUT,DELETE),\n *  not consider whether to load cache but consider whether to write cache\n *\n *  @param url                request url\n *  @param method             request method\n *  @param parameters         parameters\n *  @param cacheDuration      consider whether to write cache\n *  @param successBlock       success callback\n *  @param failureBlock       failure callback\n *\n */\n- (void)sendRequest:(NSString * _Nonnull)url\n             method:(SJRequestMethod)method\n         parameters:(id _Nullable)parameters\n      cacheDuration:(NSTimeInterval)cacheDuration\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n\n/**\n *  This method is used to send request with specific method(GET,POST,PUT,DELETE),\n *  consider whether to load cache but consider whether to write cache\n *\n *  @param url                request url\n *  @param method             request method\n *  @param parameters         parameters\n *  @param loadCache          consider whether to load cache\n *  @param cacheDuration      consider whether to write cache\n *  @param successBlock       success callback\n *  @param failureBlock       failure callback\n *\n */\n- (void)sendRequest:(NSString * _Nonnull)url\n             method:(SJRequestMethod)method\n         parameters:(id _Nullable)parameters\n          loadCache:(BOOL)loadCache\n      cacheDuration:(NSTimeInterval)cacheDuration\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n#pragma mark- Request API upload images\n\n\n/**\n *  This method is used to upload image\n *\n *  @param url                   request url\n *  @param parameters            parameters\n *  @param image                 UIImage object\n *  @param name                  file name\n *  @param mimeType              file type\n *  @param uploadProgressBlock   upload progress callback\n *  @param uploadSuccessBlock    uploadSuccess allback\n *  @param uploadFailureBlock    upload failure callback\n *\n */\n- (void)sendUploadImageRequest:(NSString * _Nonnull)url\n                    parameters:(id _Nullable)parameters\n                         image:(UIImage * _Nonnull)image\n                          name:(NSString * _Nonnull)name\n                      mimeType:(NSString * _Nullable)mimeType\n                      progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                       success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                       failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock;\n\n\n/**\n *  This method is used to upload image\n *\n *  @param url                   request url\n *  @param ignoreBaseUrl         consider whether to ignore configured base url\n *  @param parameters            parameters\n *  @param image                 UIImage object\n *  @param name                  file name\n *  @param mimeType              file type\n *  @param uploadProgressBlock   upload progress callback\n *  @param uploadSuccessBlock    upload success callback\n *  @param uploadFailureBlock    upload failure callback\n *\n */\n- (void)sendUploadImageRequest:(NSString * _Nonnull)url\n                 ignoreBaseUrl:(BOOL)ignoreBaseUrl\n                    parameters:(id _Nullable)parameters\n                         image:(UIImage * _Nonnull)image\n                          name:(NSString * _Nonnull)name\n                      mimeType:(NSString * _Nullable)mimeType\n                      progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                       success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                       failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock;\n\n\n\n/**\n *  This method is used to upload images(or only one image)\n *\n *  @param url                   request url\n *  @param parameters            parameters\n *  @param images                UIImage object array\n *  @param name                  file name\n *  @param mimeType              file type\n *  @param uploadProgressBlock   upload progress callback\n *  @param uploadSuccessBlock    upload success callback\n *  @param uploadFailureBlock    upload failure callback\n *\n */\n- (void)sendUploadImagesRequest:(NSString * _Nonnull)url\n                     parameters:(id _Nullable)parameters\n                         images:(NSArray<UIImage *> * _Nonnull)images\n                           name:(NSString * _Nonnull)name\n                       mimeType:(NSString * _Nullable)mimeType\n                       progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                        success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                        failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock;\n\n\n\n/**\n *  This method is used to upload images(or only one image)\n *\n *  @param url                   request url\n *  @param ignoreBaseUrl         consider whether to ignore configured base url\n *  @param parameters            parameters\n *  @param images                UIImage object array\n *  @param name                  file name\n *  @param mimeType              file type\n *  @param uploadProgressBlock   upload progress callback\n *  @param uploadSuccessBlock    upload success callback\n *  @param uploadFailureBlock    upload failure callback\n *\n */\n- (void)sendUploadImagesRequest:(NSString * _Nonnull)url\n                  ignoreBaseUrl:(BOOL)ignoreBaseUrl\n                     parameters:(id _Nullable)parameters\n                         images:(NSArray<UIImage *> * _Nonnull)images\n                           name:(NSString * _Nonnull)name\n                       mimeType:(NSString * _Nullable)mimeType\n                       progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                        success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                        failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock;\n\n\n\n/**\n *  This method is used to upload image\n *\n *  @param url                   request url\n *  @param parameters            parameters\n *  @param image                 UIImage object\n *  @param compressRatio         compress ratio of images\n *  @param name                  file name\n *  @param mimeType              file type\n *  @param uploadProgressBlock   upload progress callback\n *  @param uploadSuccessBlock    upload success callback\n *  @param uploadFailureBlock    upload failure callback\n *\n */\n- (void)sendUploadImageRequest:(NSString * _Nonnull)url\n                    parameters:(id _Nullable)parameters\n                         image:(UIImage * _Nonnull)image\n                 compressRatio:(float)compressRatio\n                          name:(NSString * _Nonnull)name\n                      mimeType:(NSString * _Nullable)mimeType\n                      progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                       success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                       failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock;\n\n\n/**\n *  This method is used to upload image\n *\n *  @param url                   request url\n *  @param ignoreBaseUrl         consider whether to ignore configured base url\n *  @param parameters            parameters\n *  @param image                 UIImage object\n *  @param compressRatio         compress ratio of images\n *  @param name                  file name\n *  @param mimeType              file type\n *  @param uploadProgressBlock   upload progress callback\n *  @param uploadSuccessBlock    upload success callback\n *  @param uploadFailureBlock    upload failure callback\n *\n */\n- (void)sendUploadImageRequest:(NSString * _Nonnull)url\n                 ignoreBaseUrl:(BOOL)ignoreBaseUrl\n                    parameters:(id _Nullable)parameters\n                         image:(UIImage * _Nonnull)image\n                 compressRatio:(float)compressRatio\n                          name:(NSString * _Nonnull)name\n                      mimeType:(NSString * _Nullable)mimeType\n                      progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                       success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                       failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock;\n\n\n\n\n/**\n *  This method is used to upload images(or only one image)\n *\n *  @param url                   request url\n *  @param parameters            parameters\n *  @param images                UIImage object array\n *  @param compressRatio         compress ratio of images\n *  @param name                  file name\n *  @param mimeType              file type\n *  @param uploadProgressBlock   upload progress callback\n *  @param uploadSuccessBlock    upload success callback\n *  @param uploadFailureBlock    upload failure callback\n *\n */\n- (void)sendUploadImagesRequest:(NSString * _Nonnull)url\n                     parameters:(id _Nullable)parameters\n                         images:(NSArray<UIImage *> * _Nonnull)images\n                  compressRatio:(float)compressRatio\n                           name:(NSString * _Nonnull)name\n                       mimeType:(NSString * _Nullable)mimeType\n                       progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                        success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                        failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock;\n\n\n\n\n/**\n *\n *  @param url                   request url\n *  @param ignoreBaseUrl         consider whether to ignore configured base url\n *  @param parameters            parameters\n *  @param images                UIImage object array\n *  @param compressRatio         compress ratio of images\n *  @param name                  file name\n *  @param mimeType              file type\n *  @param uploadProgressBlock   upload progress callback\n *  @param uploadSuccessBlock    upload success callback\n *  @param uploadFailureBlock    upload failure callback\n *\n */\n- (void)sendUploadImagesRequest:(NSString * _Nonnull)url\n                  ignoreBaseUrl:(BOOL)ignoreBaseUrl\n                     parameters:(id _Nullable)parameters\n                         images:(NSArray<UIImage *> * _Nonnull)images\n                  compressRatio:(float)compressRatio\n                           name:(NSString * _Nonnull)name\n                       mimeType:(NSString * _Nullable)mimeType\n                       progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                        success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                        failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock;\n\n\n\n\n\n\n#pragma mark- Request API download files\n\n/**\n *  These methods are used to download file\n *\n *  @param url                      request url\n *  @param downloadFilePath         target path of download file\n *  @param downloadProgressBlock    download progress callback\n *  @param downloadSuccessBlock     download success callback\n *  @param downloadFailureBlock     download failure callback\n *\n */\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock;\n\n\n\n\n\n/**\n *  These methods are used to download file\n *\n *  @param url                      request url\n *  @param ignoreBaseUrl            consider whether to ignore configured base url\n *  @param downloadFilePath         target path of download file\n *  @param downloadProgressBlock    download progress callback\n *  @param downloadSuccessBlock     download success callback\n *  @param downloadFailureBlock     download failure callback\n *\n */\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n              ignoreBaseUrl:(BOOL)ignoreBaseUrl\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock;\n\n\n\n\n\n\n/**\n *  These methods are used to download file\n *\n *  @param url                      request url\n *  @param downloadFilePath         target path of download file\n *  @param resumable                consider whether to save or load resumble data\n *  @param downloadProgressBlock    download progress callback\n *  @param downloadSuccessBlock     download success callback\n *  @param downloadFailureBlock     download failure callback\n *\n */\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                  resumable:(BOOL)resumable\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock;\n\n\n\n/**\n *  These methods are used to download file\n *\n *  @param url                      request url\n *  @param ignoreBaseUrl            consider whether to ignore configured base url\n *  @param downloadFilePath         target path of download file\n *  @param resumable                consider whether to save or load resumble data\n *  @param downloadProgressBlock    download progress callback\n *  @param downloadSuccessBlock     download success callback\n *  @param downloadFailureBlock     download failure callback\n *\n */\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n              ignoreBaseUrl:(BOOL)ignoreBaseUrl\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                  resumable:(BOOL)resumable\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock;\n\n\n\n/**\n *  These methods are used to download file\n *\n *  @param url                      request url\n *  @param downloadFilePath         target path of download file\n *  @param backgroundSupport        consider whether to support background downlaod\n *  @param downloadProgressBlock    download progress callback\n *  @param downloadSuccessBlock     download success callback\n *  @param downloadFailureBlock     download failure callback\n *\n */\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n          backgroundSupport:(BOOL)backgroundSupport\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock;\n\n\n\n\n/**\n *  These methods are used to download file\n *\n *  @param url                      request url\n *  @param ignoreBaseUrl            consider whether to ignore configured base url\n *  @param downloadFilePath         target path of download file\n *  @param backgroundSupport        consider whether to support background downlaod\n *  @param downloadProgressBlock    download progress callback\n *  @param downloadSuccessBlock     download success callback\n *  @param downloadFailureBlock     download failure callback\n *\n */\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n              ignoreBaseUrl:(BOOL)ignoreBaseUrl\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n          backgroundSupport:(BOOL)backgroundSupport\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock;\n\n\n/**\n *  These methods are used to download file\n *\n *  @param url                      request url\n *  @param downloadFilePath         target path of download file\n *  @param resumable                consider whether to save or load resumble data\n *  @param backgroundSupport        consider whether to support background downlaod\n *  @param downloadProgressBlock    download progress callback\n *  @param downloadSuccessBlock     download success callback\n *  @param downloadFailureBlock     download failure callback\n *\n */\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                  resumable:(BOOL)resumable\n          backgroundSupport:(BOOL)backgroundSupport\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock;\n\n\n\n\n/**\n *  These methods are used to download file\n *\n *  @param url                      request url\n *  @param ignoreBaseUrl            consider whether to ignore configured base url\n *  @param downloadFilePath         target path of download file\n *  @param resumable                consider whether to save or load resumble data\n *  @param backgroundSupport        consider whether to support background downlaod\n *  @param downloadProgressBlock    download progress callback\n *  @param downloadSuccessBlock     download success callback\n *  @param downloadFailureBlock     download failure callback\n *\n */\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n              ignoreBaseUrl:(BOOL)ignoreBaseUrl\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                  resumable:(BOOL)resumable\n          backgroundSupport:(BOOL)backgroundSupport\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock;\n\n\n//=============================== Suspend download requests ==================================//\n\n\n/**\n *  This method is used to suspend all current download requests\n */\n- (void)suspendAllDownloadRequests;\n\n\n\n\n\n/**\n *  This method is used to suspend a download request with given url\n *\n *  @param url                   download url\n *\n */\n- (void)suspendDownloadRequest:(NSString * _Nonnull)url;\n\n\n\n/**\n *  This method is used to suspend a download request with given url which contains the baseUrl or not\n *\n *  @param url                   download url\n *  @param ignoreBaseUrl         ignore baseUrl or not\n *\n */\n- (void)suspendDownloadRequest:(NSString * _Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n/**\n *  This method is used to suspend one nor more download requests with given urls array\n *\n *  @param urls                   download url array\n *\n */\n- (void)suspendDownloadRequests:(NSArray *_Nonnull)urls;\n\n\n\n\n/**\n *  This method is used to suspend one nor more download requests with given urls which contain the baseUrl or not\n *\n *  @param urls                   download url array\n *  @param ignoreBaseUrl          ignore baseUrl or not\n *\n */\n- (void)suspendDownloadRequests:(NSArray *_Nonnull)urls ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n//=============================== Resume download requests ==================================//\n\n/**\n *  This method is used to resume all suspended download requests\n */\n- (void)resumeAllDownloadRequests;\n\n\n\n\n/**\n *  This method is used to resume a suspended request with given url\n *\n *  @param url                   download url\n *\n */\n- (void)resumeDownloadReqeust:(NSString *_Nonnull)url;\n\n\n\n\n/**\n *  This method is used to resume a suspended request with given url which contains the baseUrl or not\n *\n *  @param url                   download url\n *  @param ignoreBaseUrl         ignore baseUrl or not\n *\n */\n- (void)resumeDownloadReqeust:(NSString *_Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n/**\n *  This method is used to resume one nor more suspended requests with given urls array\n *\n *  @param urls                   download url array\n *\n */\n- (void)resumeDownloadReqeusts:(NSArray *_Nonnull)urls;\n\n\n\n/**\n *  This method is used to suspend one nor more suspended requests with given urls which contain the baseUrl or not\n *\n *  @param urls                   download url array\n *  @param ignoreBaseUrl          ignore baseUrl or not\n *\n */\n- (void)resumeDownloadReqeusts:(NSArray *_Nonnull)urls ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n\n\n//=============================== Cancel download requests ==================================//\n\n\n/**\n *  This method is used to cancel all current download requests\n */\n- (void)cancelAllDownloadRequests;\n\n\n\n/**\n *  This method is used to cancel a current download request with given url\n *\n *  @param url                   download url\n *\n */\n- (void)cancelDownloadRequest:(NSString * _Nonnull)url;\n\n\n\n/**\n *  This method is used to cancel a current download request with given url which contains the baseUrl or not\n *\n *  @param url                   download url\n *  @param ignoreBaseUrl         ignore baseUrl or not\n *\n */\n- (void)cancelDownloadRequest:(NSString * _Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n\n/**\n *  This method is used to cancel one nor more current download requests with given urls array\n *\n *  @param urls                   download url array\n *\n */\n- (void)cancelDownloadRequests:(NSArray *_Nonnull)urls;\n\n\n\n\n/**\n *  This method is used to cancel one nor more current download requests with given urls which contain the baseUrl or not\n *\n *  @param urls                   download url array\n *  @param ignoreBaseUrl          ignore baseUrl or not\n *\n */\n- (void)cancelDownloadRequests:(NSArray *_Nonnull)urls ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n/**\n *  This method is used to get incomplete download data ratio of a download request with a given download url\n *\n *  @param url                    download url\n *\n *  @return incomplete download data ratio\n */\n- (CGFloat)resumeDataRatioOfRequest:(NSString *_Nonnull)url;\n\n\n\n\n\n/**\n *  This method is used to get incomplete download data ratio of a download request with a given download url which contains the baseUrl or not\n *\n *  @param url                    download url\n *  @param ignoreBaseUrl          ignore baseUrl or not\n *\n *  @return incomplete download data ratio\n */\n- (CGFloat)resumeDataRatioOfRequest:(NSString *_Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n#pragma mark- Cancel requests\n\n\n\n/**\n *  This method is used to cancel all current requests\n */\n- (void)cancelAllCurrentRequests;\n\n\n\n\n/**\n *  This method is used to cancel all current requests corresponding a reqeust url,\n    no matter what the method is and parameters are\n *\n *  @param url              request url\n *\n */\n- (void)cancelCurrentRequestWithUrl:(NSString * _Nonnull)url;\n\n\n\n\n\n\n/**\n *  This method is used to cancel all current requests corresponding a specific reqeust url, method and parameters\n *\n *  @param url              request url\n *  @param method           request method\n *  @param parameters       parameters\n *\n */\n- (void)cancelCurrentRequestWithUrl:(NSString * _Nonnull)url\n                             method:(NSString * _Nonnull)method\n                         parameters:(id _Nullable)parameters;\n\n\n\n\n#pragma mark- Cache operations\n\n\n//=============================== Load cache ==================================//\n\n/**\n *  This method is used to load cache which is related to a specific url,\n    no matter what request method is or parameters are\n *\n *\n *  @param url                  the url of related network requests\n *  @param completionBlock      callback\n *\n */\n- (void)loadCacheWithUrl:(NSString * _Nonnull)url\n         completionBlock:(SJLoadCacheArrCompletionBlock _Nullable)completionBlock;\n\n\n\n\n\n\n/**\n *  This method is used to load cache which is related to a specific url,method and parameters\n *\n *  @param url                  the url of the network request\n *  @param method               the method of the network request\n *  @param parameters           the parameters of the network request\n *  @param completionBlock      callback\n *\n */\n- (void)loadCacheWithUrl:(NSString * _Nonnull)url\n                  method:(NSString * _Nonnull)method\n              parameters:(id _Nullable)parameters\n         completionBlock:(SJLoadCacheCompletionBlock _Nullable)completionBlock;\n\n\n\n\n//=============================== calculate cache ===========================//\n\n/**\n *  This method is used to calculate the size of the cache folder\n *\n *  @param completionBlock      callback\n *\n */\n- (void)calculateCacheSizeCompletionBlock:(SJCalculateSizeCompletionBlock _Nullable)completionBlock;\n\n\n\n\n\n//================================= clear cache ==============================//\n\n/**\n *  This method is used to clear all cache which is in the cache file\n *\n *  @param completionBlock      callback\n *\n */\n- (void)clearAllCacheCompletionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock;\n\n\n\n\n/**\n *  This method is used to clear the cache which is related the specific url,\n    no matter what request method is or parameters are\n *\n *  @param url                   the url of network request\n *  @param completionBlock       callback\n *\n */\n- (void)clearCacheWithUrl:(NSString * _Nonnull)url\n          completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock;\n\n\n\n\n\n- (void)clearCacheWithUrl:(NSString * _Nonnull)url\n                   method:(NSString * _Nonnull)method\n          completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock;\n\n\n\n\n/**\n *  This method is used to clear the cache which is related the specific url and method,\n    no matter what parameters are\n *\n *  @param url                   the url of network request\n *  @param method                request method\n *  @param completionBlock       callback\n *\n */\n- (void)loadCacheWithUrl:(NSString * _Nonnull)url\n                  method:(NSString * _Nonnull)method\n         completionBlock:(SJLoadCacheArrCompletionBlock _Nullable)completionBlock;\n\n\n\n/**\n *  This method is used to clear cache which is related to a specific url,method and parameters\n *\n *  @param url                  the url of the network request\n *  @param method               the method of the network request\n *  @param parameters           the parameters of the network request\n *  @param completionBlock      callback\n *\n */\n- (void)clearCacheWithUrl:(NSString * _Nonnull)url\n                   method:(NSString * _Nonnull)method\n               parameters:(id _Nonnull)parameters\n          completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock;\n\n\n\n#pragma mark- Request Info\n\n\n/**\n *  This method is used to log all current requests' information\n */\n- (void)logAllCurrentRequests;\n\n\n\n/**\n *  This method is used to check if there is remaining curent request\n *\n *  @return if there is remaining requests\n */\n- (BOOL)remainingCurrentRequests;\n\n\n\n/**\n *  This method is used to calculate the count of current requests\n *\n *  @return the count of current requests\n */\n- (NSInteger)currentRequestCount;\n\n\n\n\n@end\n"
  },
  {
    "path": "SJNetwork/SJNetworkManager.m",
    "content": "//\n//  SJNetworkManager.m\n//  SJNetwork\n//\n//  Created by Sun Shijie on 2017/8/16.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"SJNetworkManager.h\"\n\n#import \"SJNetworkConfig.h\"\n#import \"SJNetworkRequestPool.h\"\n\n#import \"SJNetworkRequestEngine.h\"\n#import \"SJNetworkUploadEngine.h\"\n#import \"SJNetworkDownloadEngine.h\"\n\n@interface SJNetworkManager()\n\n@property (nonatomic, strong) SJNetworkRequestEngine *requestEngine;\n@property (nonatomic, strong) SJNetworkUploadEngine *uploadEngine;\n@property (nonatomic, strong) SJNetworkDownloadEngine *downloadEngine;\n\n@property (nonatomic, strong) SJNetworkRequestPool *requestPool;\n@property (nonatomic, strong) SJNetworkCacheManager *cacheManager;\n\n@end\n\n\n@implementation SJNetworkManager\n\n\n#pragma mark- ============== Life Cycle ===========\n\n+ (SJNetworkManager *_Nullable)sharedManager {\n    \n    static SJNetworkManager *sharedManager = NULL;\n    static dispatch_once_t onceToken;\n    \n    dispatch_once(&onceToken, ^{\n         sharedManager = [[SJNetworkManager alloc] init];\n    });\n    return sharedManager;\n}\n\n\n- (void)dealloc{\n    \n    [self cancelAllCurrentRequests];\n}\n\n#pragma mark- ============== Public Methods ==============\n\n\n- (void)addCustomHeader:(NSDictionary *_Nonnull)header{\n    \n    [[SJNetworkConfig sharedConfig] addCustomHeader:header];\n}\n\n\n\n\n- (NSDictionary *_Nullable)customHeaders{\n    \n    return [SJNetworkConfig sharedConfig].customHeaders;\n}\n\n\n#pragma mark- ============== Request API using GET method ==============\n\n\n- (void)sendGetRequest:(NSString * _Nonnull)url\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodGET\n                          parameters:nil\n                           loadCache:NO\n                       cacheDuration:0\n                             success:successBlock\n                             failure:failureBlock];\n    \n}\n\n\n\n\n\n- (void)sendGetRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodGET\n                          parameters:parameters\n                           loadCache:NO\n                       cacheDuration:0\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n- (void)sendGetRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n             loadCache:(BOOL)loadCache\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodGET\n                          parameters:parameters\n                           loadCache:loadCache\n                       cacheDuration:0\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n\n- (void)sendGetRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n         cacheDuration:(NSTimeInterval)cacheDuration\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock{\n\n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodGET\n                          parameters:parameters\n                           loadCache:NO\n                       cacheDuration:cacheDuration\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n\n- (void)sendGetRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n             loadCache:(BOOL)loadCache\n         cacheDuration:(NSTimeInterval)cacheDuration\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodGET\n                          parameters:parameters\n                           loadCache:loadCache\n                       cacheDuration:cacheDuration\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n#pragma mark- ============== Request API using POST method ==============\n\n- (void)sendPostRequest:(NSString * _Nonnull)url\n             parameters:(id _Nullable)parameters\n                success:(SJSuccessBlock _Nullable)successBlock\n                failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodPOST\n                          parameters:parameters\n                           loadCache:NO\n                       cacheDuration:0\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n- (void)sendPostRequest:(NSString * _Nonnull)url\n             parameters:(id _Nullable)parameters\n              loadCache:(BOOL)loadCache\n                success:(SJSuccessBlock _Nullable)successBlock\n                failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodPOST\n                          parameters:parameters\n                           loadCache:loadCache\n                       cacheDuration:0\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n- (void)sendPostRequest:(NSString * _Nonnull)url\n             parameters:(id _Nullable)parameters\n          cacheDuration:(NSTimeInterval)cacheDuration\n                success:(SJSuccessBlock _Nullable)successBlock\n                failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodPOST\n                          parameters:parameters\n                           loadCache:NO\n                       cacheDuration:cacheDuration\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n\n- (void)sendPostRequest:(NSString * _Nonnull)url\n             parameters:(id _Nullable)parameters\n              loadCache:(BOOL)loadCache\n          cacheDuration:(NSTimeInterval)cacheDuration\n                success:(SJSuccessBlock _Nullable)successBlock\n                failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodPOST\n                          parameters:parameters\n                           loadCache:loadCache\n                       cacheDuration:cacheDuration\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n\n#pragma mark- ============== Request API using PUT method ==============\n\n- (void)sendPutRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodPUT\n                          parameters:parameters\n                           loadCache:NO\n                       cacheDuration:0\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n- (void)sendPutRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n             loadCache:(BOOL)loadCache\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodPUT\n                          parameters:parameters\n                           loadCache:loadCache\n                       cacheDuration:0\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n- (void)sendPutRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n         cacheDuration:(NSTimeInterval)cacheDuration\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodPUT\n                          parameters:parameters\n                           loadCache:NO\n                       cacheDuration:cacheDuration\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n- (void)sendPutRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n             loadCache:(BOOL)loadCache\n         cacheDuration:(NSTimeInterval)cacheDuration\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodPUT\n                          parameters:parameters\n                           loadCache:loadCache\n                       cacheDuration:cacheDuration\n                             success:successBlock\n                             failure:failureBlock];\n    \n}\n\n\n\n#pragma mark- ============== Request API using DELETE method ==============\n\n- (void)sendDeleteRequest:(NSString * _Nonnull)url\n               parameters:(id _Nullable)parameters\n                  success:(SJSuccessBlock _Nullable)successBlock\n                  failure:(SJFailureBlock _Nullable)failureBlock{\n\n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodDELETE\n                          parameters:parameters\n                           loadCache:NO\n                       cacheDuration:0\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n- (void)sendDeleteRequest:(NSString * _Nonnull)url\n               parameters:(id _Nullable)parameters\n                loadCache:(BOOL)loadCache\n                  success:(SJSuccessBlock _Nullable)successBlock\n                  failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodDELETE\n                          parameters:parameters\n                           loadCache:loadCache\n                       cacheDuration:0\n                             success:successBlock\n                             failure:failureBlock];\n    \n}\n\n\n\n\n- (void)sendDeleteRequest:(NSString * _Nonnull)url\n               parameters:(id _Nullable)parameters\n            cacheDuration:(NSTimeInterval)cacheDuration\n                  success:(SJSuccessBlock _Nullable)successBlock\n                  failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodDELETE\n                          parameters:parameters\n                           loadCache:NO\n                       cacheDuration:cacheDuration\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n- (void)sendDeleteRequest:(NSString * _Nonnull)url\n               parameters:(id _Nullable)parameters\n                loadCache:(BOOL)loadCache\n            cacheDuration:(NSTimeInterval)cacheDuration\n                  success:(SJSuccessBlock _Nullable)successBlock\n                  failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodDELETE\n                          parameters:parameters\n                           loadCache:loadCache\n                       cacheDuration:cacheDuration\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n\n#pragma mark- ============== Request API using specific parameters ==============\n\n\n- (void)sendRequest:(NSString * _Nonnull)url\n         parameters:(id _Nullable)parameters\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock{\n    \n    if (parameters) {\n        \n         [self.requestEngine sendRequest:url\n                                  method:SJRequestMethodPOST\n                              parameters:parameters\n                               loadCache:NO\n                           cacheDuration:0\n                                 success:successBlock\n                                 failure:failureBlock];\n        \n    }else{\n        \n         [self.requestEngine sendRequest:url\n                                  method:SJRequestMethodGET\n                              parameters:nil\n                               loadCache:NO\n                           cacheDuration:0\n                                 success:successBlock\n                                 failure:failureBlock];\n    }\n}\n\n\n\n\n\n- (void)sendRequest:(NSString * _Nonnull)url\n         parameters:(id _Nullable)parameters\n          loadCache:(BOOL)loadCache\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock{\n    \n    if (parameters) {\n    \n         [self.requestEngine sendRequest:url\n                                  method:SJRequestMethodPOST\n                              parameters:parameters\n                               loadCache:loadCache\n                           cacheDuration:0\n                                 success:successBlock\n                                 failure:failureBlock];\n        \n    }else{\n        \n         [self.requestEngine sendRequest:url\n                                  method:SJRequestMethodGET\n                              parameters:nil\n                               loadCache:loadCache\n                           cacheDuration:0\n                                 success:successBlock\n                                 failure:failureBlock];\n    }\n}\n\n\n\n\n- (void)sendRequest:(NSString * _Nonnull)url\n         parameters:(id _Nullable)parameters\n      cacheDuration:(NSTimeInterval)cacheDuration\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock{\n    \n    if (parameters) {\n        \n         [self.requestEngine sendRequest:url\n                                  method:SJRequestMethodPOST\n                              parameters:parameters\n                               loadCache:NO\n                           cacheDuration:cacheDuration\n                                 success:successBlock\n                                 failure:failureBlock];\n        \n    }else{\n        \n        \n         [self.requestEngine sendRequest:url\n                                  method:SJRequestMethodGET\n                              parameters:nil\n                               loadCache:NO\n                           cacheDuration:cacheDuration\n                                 success:successBlock\n                                 failure:failureBlock];\n    }\n}\n\n\n\n\n- (void)sendRequest:(NSString * _Nonnull)url\n         parameters:(id _Nullable)parameters\n          loadCache:(BOOL)loadCache\n      cacheDuration:(NSTimeInterval)cacheDuration\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock{\n    \n    \n    if (parameters) {\n        \n         [self.requestEngine sendRequest:url\n                                  method:SJRequestMethodPOST\n                              parameters:parameters\n                               loadCache:loadCache\n                           cacheDuration:cacheDuration\n                                 success:successBlock\n                                 failure:failureBlock];\n    }else{\n        \n        \n         [self.requestEngine sendRequest:url\n                                  method:SJRequestMethodGET\n                              parameters:nil\n                               loadCache:loadCache\n                           cacheDuration:cacheDuration\n                                 success:successBlock\n                                 failure:failureBlock];\n    }\n}\n\n\n\n#pragma mark- ============== Request API using specific request method ==============\n\n- (void)sendRequest:(NSString * _Nonnull)url\n             method:(SJRequestMethod)method\n         parameters:(id _Nullable)parameters\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock{\n  \n     [self.requestEngine sendRequest:url\n                              method:method\n                          parameters:parameters\n                           loadCache:NO\n                       cacheDuration:0\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n- (void)sendRequest:(NSString * _Nonnull)url\n             method:(SJRequestMethod)method\n         parameters:(id _Nullable)parameters\n          loadCache:(BOOL)loadCache\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:method\n                          parameters:parameters\n                           loadCache:loadCache\n                       cacheDuration:0\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n- (void)sendRequest:(NSString * _Nonnull)url\n             method:(SJRequestMethod)method\n         parameters:(id _Nullable)parameters\n      cacheDuration:(NSTimeInterval)cacheDuration\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:method\n                          parameters:parameters\n                           loadCache:NO\n                       cacheDuration:cacheDuration\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n- (void)sendRequest:(NSString * _Nonnull)url\n             method:(SJRequestMethod)method\n         parameters:(id _Nullable)parameters\n          loadCache:(BOOL)loadCache\n      cacheDuration:(NSTimeInterval)cacheDuration\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:method\n                          parameters:parameters\n                           loadCache:loadCache\n                       cacheDuration:cacheDuration\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n#pragma mark- ============== Request API uploading ==============\n\n\n- (void)sendUploadImageRequest:(NSString * _Nonnull)url\n                    parameters:(id _Nullable)parameters\n                         image:(UIImage * _Nonnull)image\n                          name:(NSString * _Nonnull)name\n                      mimeType:(NSString * _Nullable)mimeType\n                      progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                       success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                       failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock{\n    \n    \n     [self.uploadEngine sendUploadImagesRequest:url\n                                  ignoreBaseUrl:NO\n                                     parameters:parameters\n                                         images:@[image]\n                                  compressRatio:1\n                                           name:name\n                                       mimeType:mimeType\n                                       progress:uploadProgressBlock\n                                        success:uploadSuccessBlock\n                                        failure:uploadFailureBlock];\n}\n\n\n\n\n\n- (void)sendUploadImageRequest:(NSString * _Nonnull)url\n                 ignoreBaseUrl:(BOOL)ignoreBaseUrl\n                    parameters:(id _Nullable)parameters\n                         image:(UIImage * _Nonnull)image\n                          name:(NSString * _Nonnull)name\n                      mimeType:(NSString * _Nullable)mimeType\n                      progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                       success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                       failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock{\n\n    \n     [self.uploadEngine sendUploadImagesRequest:url\n                                  ignoreBaseUrl:ignoreBaseUrl\n                                     parameters:parameters\n                                         images:@[image]\n                                  compressRatio:1\n                                           name:name\n                                       mimeType:mimeType\n                                       progress:uploadProgressBlock\n                                        success:uploadSuccessBlock\n                                        failure:uploadFailureBlock];\n\n}\n\n\n\n\n- (void)sendUploadImagesRequest:(NSString * _Nonnull)url\n                     parameters:(id _Nullable)parameters\n                         images:(NSArray<UIImage *> * _Nonnull)images\n                           name:(NSString * _Nonnull)name\n                       mimeType:(NSString * _Nullable)mimeType\n                       progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                        success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                        failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock{\n    \n    \n     [self.uploadEngine sendUploadImagesRequest:url\n                                  ignoreBaseUrl:NO\n                                     parameters:parameters\n                                         images:images\n                                  compressRatio:1\n                                           name:name\n                                       mimeType:mimeType\n                                       progress:uploadProgressBlock\n                                        success:uploadSuccessBlock\n                                        failure:uploadFailureBlock];\n\n}\n\n\n\n\n- (void)sendUploadImagesRequest:(NSString * _Nonnull)url\n                  ignoreBaseUrl:(BOOL)ignoreBaseUrl\n                     parameters:(id _Nullable)parameters\n                         images:(NSArray<UIImage *> * _Nonnull)images\n                           name:(NSString * _Nonnull)name\n                       mimeType:(NSString * _Nullable)mimeType\n                       progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                        success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                        failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock{\n    \n    \n     [self.uploadEngine sendUploadImagesRequest:url\n                                  ignoreBaseUrl:ignoreBaseUrl\n                                     parameters:parameters\n                                         images:images\n                                  compressRatio:1\n                                           name:name\n                                       mimeType:mimeType\n                                       progress:uploadProgressBlock\n                                        success:uploadSuccessBlock\n                                        failure:uploadFailureBlock];\n \n}\n\n\n\n\n- (void)sendUploadImageRequest:(NSString * _Nonnull)url\n                    parameters:(id _Nullable)parameters\n                         image:(UIImage * _Nonnull)image\n                 compressRatio:(float)compressRatio\n                          name:(NSString * _Nonnull)name\n                      mimeType:(NSString * _Nullable)mimeType\n                      progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                       success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                       failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock{\n    \n     [self.uploadEngine sendUploadImagesRequest:url\n                                  ignoreBaseUrl:NO\n                                     parameters:parameters\n                                         images:@[image]\n                                  compressRatio:compressRatio\n                                           name:name\n                                       mimeType:mimeType\n                                       progress:uploadProgressBlock\n                                        success:uploadSuccessBlock\n                                        failure:uploadFailureBlock];\n    \n\n}\n\n\n\n\n- (void)sendUploadImageRequest:(NSString * _Nonnull)url\n                 ignoreBaseUrl:(BOOL)ignoreBaseUrl\n                    parameters:(id _Nullable)parameters\n                         image:(UIImage * _Nonnull)image\n                 compressRatio:(float)compressRatio\n                          name:(NSString * _Nonnull)name\n                      mimeType:(NSString * _Nullable)mimeType\n                      progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                       success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                       failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock{\n\n    \n     [self.uploadEngine sendUploadImagesRequest:url\n                                  ignoreBaseUrl:ignoreBaseUrl\n                                     parameters:parameters\n                                         images:@[image]\n                                  compressRatio:compressRatio\n                                           name:name\n                                       mimeType:mimeType\n                                       progress:uploadProgressBlock\n                                        success:uploadSuccessBlock\n                                        failure:uploadFailureBlock];\n}\n\n\n\n\n- (void)sendUploadImagesRequest:(NSString * _Nonnull)url\n                     parameters:(id _Nullable)parameters\n                         images:(NSArray<UIImage *> * _Nonnull)images\n                  compressRatio:(float)compressRatio\n                           name:(NSString * _Nonnull)name\n                       mimeType:(NSString * _Nullable)mimeType\n                       progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                        success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                        failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock{\n    \n     [self.uploadEngine sendUploadImagesRequest:url\n                                  ignoreBaseUrl:NO\n                                     parameters:parameters\n                                         images:images\n                                  compressRatio:compressRatio\n                                           name:name\n                                       mimeType:mimeType\n                                       progress:uploadProgressBlock\n                                        success:uploadSuccessBlock\n                                        failure:uploadFailureBlock];\n}\n\n\n\n\n- (void)sendUploadImagesRequest:(NSString * _Nonnull)url\n                  ignoreBaseUrl:(BOOL)ignoreBaseUrl\n                     parameters:(id _Nullable)parameters\n                         images:(NSArray<UIImage *> * _Nonnull)images\n                  compressRatio:(float)compressRatio\n                           name:(NSString * _Nonnull)name\n                       mimeType:(NSString * _Nullable)mimeType\n                       progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                        success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                        failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock{\n\n     [self.uploadEngine sendUploadImagesRequest:url\n                                  ignoreBaseUrl:ignoreBaseUrl\n                                     parameters:parameters\n                                         images:images\n                                  compressRatio:compressRatio\n                                           name:name\n                                       mimeType:mimeType\n                                       progress:uploadProgressBlock\n                                        success:uploadSuccessBlock\n                                        failure:uploadFailureBlock];\n}\n\n\n\n\n#pragma mark- ============== Request API downloading ==============\n\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock{\n    \n    \n     [self.downloadEngine sendDownloadRequest:url\n                                ignoreBaseUrl:NO\n                             downloadFilePath:downloadFilePath\n                                    resumable:YES\n                            backgroundSupport:NO\n                                     progress:downloadProgressBlock\n                                      success:downloadSuccessBlock\n                                      failure:downloadFailureBlock];\n}\n\n\n\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n              ignoreBaseUrl:(BOOL)ignoreBaseUrl\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock{\n    \n    \n     [self.downloadEngine sendDownloadRequest:url\n                                ignoreBaseUrl:ignoreBaseUrl\n                             downloadFilePath:downloadFilePath\n                                    resumable:YES\n                            backgroundSupport:NO\n                                     progress:downloadProgressBlock\n                                      success:downloadSuccessBlock\n                                      failure:downloadFailureBlock];\n    \n}\n\n\n\n\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                  resumable:(BOOL)resumable\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock{\n    \n    \n     [self.downloadEngine sendDownloadRequest:url\n                                ignoreBaseUrl:NO\n                             downloadFilePath:downloadFilePath\n                                    resumable:resumable\n                            backgroundSupport:NO\n                                     progress:downloadProgressBlock\n                                      success:downloadSuccessBlock\n                                      failure:downloadFailureBlock];\n}\n\n\n\n\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n              ignoreBaseUrl:(BOOL)ignoreBaseUrl\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                  resumable:(BOOL)resumable\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock{\n    \n    \n     [self.downloadEngine sendDownloadRequest:url\n                                ignoreBaseUrl:ignoreBaseUrl\n                             downloadFilePath:downloadFilePath\n                                    resumable:resumable\n                            backgroundSupport:NO\n                                     progress:downloadProgressBlock\n                                      success:downloadSuccessBlock\n                                      failure:downloadFailureBlock];\n}\n\n\n\n\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n          backgroundSupport:(BOOL)backgroundSupport\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock{\n    \n     [self.downloadEngine sendDownloadRequest:url\n                                ignoreBaseUrl:NO\n                             downloadFilePath:downloadFilePath\n                                    resumable:YES\n                            backgroundSupport:NO\n                                     progress:downloadProgressBlock\n                                      success:downloadSuccessBlock\n                                      failure:downloadFailureBlock];\n    \n}\n\n\n\n\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n              ignoreBaseUrl:(BOOL)ignoreBaseUrl\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n          backgroundSupport:(BOOL)backgroundSupport\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock{\n    \n     [self.downloadEngine sendDownloadRequest:url\n                                ignoreBaseUrl:ignoreBaseUrl\n                             downloadFilePath:downloadFilePath\n                                    resumable:YES\n                            backgroundSupport:NO\n                                     progress:downloadProgressBlock\n                                      success:downloadSuccessBlock\n                                      failure:downloadFailureBlock];\n    \n}\n\n\n\n\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                  resumable:(BOOL)resumable\n          backgroundSupport:(BOOL)backgroundSupport\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock{\n    \n    \n     [self.downloadEngine sendDownloadRequest:url\n                                ignoreBaseUrl:NO\n                             downloadFilePath:downloadFilePath\n                                    resumable:resumable\n                            backgroundSupport:backgroundSupport\n                                     progress:downloadProgressBlock\n                                      success:downloadSuccessBlock\n                                      failure:downloadFailureBlock];\n}\n\n\n\n\n\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n              ignoreBaseUrl:(BOOL)ignoreBaseUrl\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                  resumable:(BOOL)resumable\n          backgroundSupport:(BOOL)backgroundSupport\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock{\n    \n    \n     [self.downloadEngine sendDownloadRequest:url\n                                ignoreBaseUrl:ignoreBaseUrl\n                             downloadFilePath:downloadFilePath\n                                    resumable:resumable\n                            backgroundSupport:backgroundSupport\n                                     progress:downloadProgressBlock\n                                      success:downloadSuccessBlock\n                                      failure:downloadFailureBlock];\n}\n\n\n\n#pragma mark- ============== Download suspend operation ==============\n\n- (void)suspendAllDownloadRequests{\n    \n     [self.downloadEngine suspendAllDownloadRequests];\n}\n\n\n\n\n- (void)suspendDownloadRequest:(NSString * _Nonnull)url{\n    \n     [self.downloadEngine suspendDownloadRequest:url];\n}\n\n\n\n\n- (void)suspendDownloadRequest:(NSString * _Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n     [self.downloadEngine suspendDownloadRequest:url ignoreBaseUrl:ignoreBaseUrl];\n}\n\n\n\n\n- (void)suspendDownloadRequests:(NSArray *_Nonnull)urls{\n    \n     [self.downloadEngine suspendDownloadRequests:urls];\n}\n\n\n\n\n- (void)suspendDownloadRequests:(NSArray *_Nonnull)urls ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n     [self.downloadEngine suspendDownloadRequests:urls ignoreBaseUrl:ignoreBaseUrl];\n}\n\n\n\n#pragma mark- ============== Download resume operation ==============\n\n- (void)resumeAllDownloadRequests{\n    \n     [self.downloadEngine resumeAllDownloadRequests];\n}\n\n\n\n- (void)resumeDownloadReqeust:(NSString *_Nonnull)url{\n    \n     [self.downloadEngine resumeDownloadReqeust:url];\n}\n\n\n\n\n- (void)resumeDownloadReqeust:(NSString *_Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n     [self.downloadEngine resumeDownloadReqeust:url ignoreBaseUrl:ignoreBaseUrl];\n}\n\n\n\n\n- (void)resumeDownloadReqeusts:(NSArray *_Nonnull)urls{\n    \n     [self.downloadEngine resumeDownloadReqeusts:urls];\n}\n\n\n\n\n- (void)resumeDownloadReqeusts:(NSArray *_Nonnull)urls ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n     [self.downloadEngine resumeDownloadReqeusts:urls ignoreBaseUrl:ignoreBaseUrl];\n}\n\n\n\n#pragma mark- ============== Download cancel operation ==============\n\n- (void)cancelAllDownloadRequests{\n    \n     [self.downloadEngine cancelAllDownloadRequests];\n}\n\n\n\n- (void)cancelDownloadRequest:(NSString * _Nonnull)url{\n    \n     [self.downloadEngine cancelDownloadRequest:url];\n    \n}\n\n\n\n- (void)cancelDownloadRequest:(NSString * _Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n     [self.downloadEngine cancelDownloadRequest:url ignoreBaseUrl:ignoreBaseUrl];\n}\n\n\n\n\n- (void)cancelDownloadRequests:(NSArray *_Nonnull)urls{\n    \n     [self.downloadEngine cancelDownloadRequests:urls];\n}\n\n\n\n\n- (void)cancelDownloadRequests:(NSArray *_Nonnull)urls ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n     [self.downloadEngine cancelDownloadRequests:urls ignoreBaseUrl:ignoreBaseUrl];\n}\n\n\n\n#pragma mark- ============== Download resume data ratio ==============\n\n- (CGFloat)resumeDataRatioOfRequest:(NSString *_Nonnull)url{\n    \n    return  [self.downloadEngine resumeDataRatioOfRequest:url];\n}\n\n\n\n- (CGFloat)resumeDataRatioOfRequest:(NSString *_Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n    return  [self.downloadEngine resumeDataRatioOfRequest:url ignoreBaseUrl:ignoreBaseUrl];\n}\n\n\n#pragma mark- ============== Request Operation ==============\n\n- (void)cancelAllCurrentRequests{\n    \n    [self.requestPool cancelAllCurrentRequests];\n}\n\n\n\n\n- (void)cancelCurrentRequestWithUrl:(NSString *)url{\n    \n    [self.requestPool cancelCurrentRequestWithUrl:url];\n}\n\n\n\n\n\n- (void)cancelCurrentRequestWithUrl:(NSString * _Nonnull)url\n                             method:(NSString * _Nonnull)method\n                         parameters:(id _Nullable)parameters{\n    \n    [self.requestPool cancelCurrentRequestWithUrl:url\n                                           method:method\n                                       parameters:parameters];\n    \n}\n\n\n\n#pragma mark- ============== Request Info ==============\n\n- (void)logAllCurrentRequests{\n    \n    [self.requestPool logAllCurrentRequests];\n}\n\n\n\n\n- (BOOL)remainingCurrentRequests{\n    \n    return [self.requestPool remainingCurrentRequests];\n}\n\n\n\n\n- (NSInteger)currentRequestCount{\n    \n    return [self.requestPool currentRequestCount];\n}\n\n\n\n#pragma mark- ============== Cache Operations ==============\n\n\n#pragma mark Load cache\n\n\n- (void)loadCacheWithUrl:(NSString * _Nonnull)url completionBlock:(SJLoadCacheArrCompletionBlock _Nullable)completionBlock{\n    \n    [self.cacheManager loadCacheWithUrl:url completionBlock:completionBlock];\n}\n\n\n\n- (void)loadCacheWithUrl:(NSString * _Nonnull)url\n                  method:(NSString * _Nonnull)method\n         completionBlock:(SJLoadCacheArrCompletionBlock _Nullable)completionBlock{\n    \n    [self.cacheManager loadCacheWithUrl:url\n                                 method:method\n                        completionBlock:completionBlock];\n}\n\n\n\n- (void)loadCacheWithUrl:(NSString * _Nonnull)url\n                  method:(NSString * _Nonnull)method\n              parameters:(id _Nullable)parameters\n         completionBlock:(SJLoadCacheCompletionBlock _Nullable)completionBlock{\n    \n    [self.cacheManager loadCacheWithUrl:url\n                                 method:method\n                             parameters:parameters\n                        completionBlock:completionBlock];\n}\n\n\n\n#pragma mark calculate cache\n\n- (void)calculateCacheSizeCompletionBlock:(SJCalculateSizeCompletionBlock _Nullable)completionBlock{\n    \n    [self.cacheManager calculateAllCacheSizecompletionBlock:completionBlock];\n}\n\n\n\n#pragma mark clear cache\n\n- (void)clearAllCacheCompletionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock{\n    \n    [self.cacheManager clearAllCacheCompletionBlock:completionBlock];\n}\n\n\n\n\n- (void)clearCacheWithUrl:(NSString * _Nonnull)url completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock{\n    \n    [self.cacheManager clearCacheWithUrl:url completionBlock:completionBlock];\n}\n\n\n\n- (void)clearCacheWithUrl:(NSString * _Nonnull)url\n                   method:(NSString * _Nonnull)method\n          completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock{\n    \n    \n    [self.cacheManager clearCacheWithUrl:url\n                                  method:method\n                         completionBlock:completionBlock];\n    \n}\n\n\n\n- (void)clearCacheWithUrl:(NSString * _Nonnull)url\n                   method:(NSString * _Nonnull)method\n               parameters:(id _Nonnull)parameters\n          completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock{\n    \n    [self.cacheManager clearCacheWithUrl:url\n                                  method:method\n                              parameters:parameters\n                         completionBlock:completionBlock];\n    \n}\n\n#pragma mark- Setter and Getter\n\n\n- (SJNetworkRequestPool *)requestPool{\n    \n    if (!_requestPool) {\n         _requestPool = [SJNetworkRequestPool sharedPool];\n    }\n    return _requestPool;\n}\n\n\n\n- (SJNetworkCacheManager *)cacheManager{\n    \n    if (!_cacheManager) {\n         _cacheManager = [SJNetworkCacheManager sharedManager];\n    }\n    return _cacheManager;\n}\n\n\n\n\n- (SJNetworkRequestEngine *)requestEngine{\n    \n    if (!_requestEngine) {\n         _requestEngine = [[SJNetworkRequestEngine alloc] init];\n    }\n    return _requestEngine;\n}\n\n\n\n\n- (SJNetworkUploadEngine *)uploadEngine{\n    \n    if (!_uploadEngine) {\n         _uploadEngine = [[SJNetworkUploadEngine alloc] init];\n    }\n    return _uploadEngine;\n}\n\n\n\n\n- (SJNetworkDownloadEngine *)downloadEngine{\n    \n    if (!_downloadEngine) {\n         _downloadEngine = [[SJNetworkDownloadEngine alloc] init];;\n    }\n    return _downloadEngine;\n}\n\n@end\n"
  },
  {
    "path": "SJNetwork/SJNetworkProtocol.h",
    "content": "//\n//  SJNetworkProtocol.h\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/12/6.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n\n@class SJNetworkRequestModel;\n\n@protocol SJNetworkProtocol <NSObject>\n\n@required\n\n/**\n *  This method is used to deal with the request model when the corresponding request is finished\n *\n *  @param requestModel      request model of a network request\n *\n */\n- (void)handleRequesFinished:(SJNetworkRequestModel *)requestModel;\n\n\n\n@end\n"
  },
  {
    "path": "SJNetwork/SJNetworkRequestEngine.h",
    "content": "//\n//  SJNetworkRequestManager.h\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/26.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n#import \"SJNetworkBaseEngine.h\"\n\n/* =============================\n *\n * SJNetworkRequestEngine\n *\n * SJNetworkRequestEngine is in charge of sending GET,POST,PUT or DELETE requests.\n *\n * =============================\n */\n\n\n@interface SJNetworkRequestEngine : SJNetworkBaseEngine\n\n\n\n/**\n *  This method offers the most number of parameters of a certain network request.\n *\n *\n *  @note:\n *\n *        1. SJRequestMethod:\n *\n *             a) If the method is set to be 'SJRequestMethodGET', then send GET request\n *             b) If the method is set to be 'SJRequestMethodPOST', then send POST request\n *             c) If the method is set to be 'SJRequestMethodPUT', then send PUT request\n *             d) If the method is set to be 'SJRequestMethodDELETE', then send DELETE request\n *\n *\n *        2. If 'loadCache' is set to be YES, then cache will be tried to\n *           load before sending network request no matter if the cache exists:\n *           If it exists, then load it and callback immediately.\n *           If it dose not exist,then send network request.\n *\n *           If 'loadCache' is set to be NO, then no matter if the cache\n *           exists, network request will be sent.\n *\n *\n *        3. If 'cacheDuration' is set to be large than 0,\n *           then the cache of this request will be written and\n *           the available duration of this cache will be equal to 'cacheDuration'.\n *\n *           So, if the past time is longer than the settled time duration,\n *           the network request will be sent.\n *\n *           If 'cacheDuration' is set to be less or equal to 0, then the cache\n *           of this request will not be written(The unit of cacheDuration is second).\n *\n *\n *\n *  @param url                request url\n *  @param method             request method\n *  @param parameters         parameters\n *  @param loadCache          consider whether to load cache\n *  @param cacheDuration      consider whether to write cache\n *  @param successBlock       success callback\n *  @param failureBlock       failure callback\n *\n */\n- (void)sendRequest:(NSString * _Nonnull)url\n             method:(SJRequestMethod)method\n         parameters:(id _Nullable)parameters\n          loadCache:(BOOL)loadCache\n      cacheDuration:(NSTimeInterval)cacheDuration\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n@end\n"
  },
  {
    "path": "SJNetwork/SJNetworkRequestEngine.m",
    "content": "//\n//  SJNetworkRequestManager.m\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/26.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"SJNetworkRequestEngine.h\"\n#import \"SJNetworkCacheManager.h\"\n#import \"SJNetworkRequestPool.h\"\n#import \"SJNetworkConfig.h\"\n#import \"SJNetworkUtils.h\"\n#import \"SJNetworkProtocol.h\"\n\n@interface SJNetworkRequestEngine()<SJNetworkProtocol>\n\n@property (nonatomic, strong) AFHTTPSessionManager *sessionManager;\n@property (nonatomic, strong) SJNetworkCacheManager *cacheManager;\n\n@end\n\n\n@implementation SJNetworkRequestEngine\n{\n    NSFileManager *_fileManager;\n    BOOL _isDebugMode;\n}\n\n\n#pragma mark- ============== Life Cycle Methods ==============\n\n\n- (instancetype)init{\n    \n    self = [super init];\n    if (self) {\n        \n        //file  manager\n        _fileManager = [NSFileManager defaultManager];\n        \n        //cachec manager\n        _cacheManager = [SJNetworkCacheManager sharedManager];\n        \n        //debug mode or not\n        _isDebugMode = [SJNetworkConfig sharedConfig].debugMode;\n        \n        //AFSessionManager config\n        _sessionManager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];\n        \n        //RequestSerializer\n        _sessionManager.requestSerializer = [AFJSONRequestSerializer serializer];\n        _sessionManager.requestSerializer.allowsCellularAccess = YES;\n        \n        _sessionManager.requestSerializer.timeoutInterval = [SJNetworkConfig sharedConfig].timeoutSeconds;\n        \n        //securityPolicy\n        _sessionManager.securityPolicy = [AFSecurityPolicy defaultPolicy];\n        [_sessionManager.securityPolicy setAllowInvalidCertificates:YES];\n        _sessionManager.securityPolicy.validatesDomainName = NO;\n        \n        //ResponseSerializer\n        _sessionManager.responseSerializer = [AFJSONResponseSerializer serializer];\n        _sessionManager.responseSerializer.acceptableContentTypes=[[NSSet alloc] initWithObjects:@\"application/xml\", @\"text/xml\",@\"text/html\", @\"application/json\",@\"text/plain\",nil];\n        \n        //Queue\n        _sessionManager.completionQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);\n        _sessionManager.operationQueue.maxConcurrentOperationCount = 5;\n        \n    }\n    return self;\n}\n\n\n#pragma mark- ============== Public Methods ==============\n\n\n- (void)sendRequest:(NSString *)url\n             method:(SJRequestMethod)method\n         parameters:(id)parameters\n          loadCache:(BOOL)loadCache\n      cacheDuration:(NSTimeInterval)cacheDuration\n            success:(SJSuccessBlock)successBlock\n            failure:(SJFailureBlock)failureBlock{\n    \n\n    //generate complete url string\n    NSString *completeUrlStr = [SJNetworkUtils generateCompleteRequestUrlStrWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                             requestUrlStr:url];\n    \n    \n    //request method\n    NSString *methodStr = [self p_methodStringFromRequestMethod:method];\n    \n    \n    //generate a unique identifer of a certain request\n    NSString *requestIdentifer = [SJNetworkUtils generateRequestIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                          requestUrlStr:url\n                                                                              methodStr:methodStr\n                                                                             parameters:parameters];\n    \n    \n    if (loadCache) {\n        \n        //if client wants to load cache\n        [_cacheManager loadCacheWithRequestIdentifer:requestIdentifer completionBlock:^(id  _Nullable cacheObject) {\n            \n            if (cacheObject) {\n                \n                dispatch_async(dispatch_get_main_queue(), ^{\n                    \n                    if(_isDebugMode){\n                        SJLog(@\"=========== Request succeed by loading Cache! \\n =========== Request url:%@\\n =========== Response object:%@\", completeUrlStr,cacheObject);\n                    }\n                    \n                    if (successBlock) {\n                        successBlock(cacheObject);\n                        return;\n                    }\n                });\n                \n                \n            }else{\n                \n                SJLog(@\"=========== Failed to load cache, start to sending network request...\");\n                [self p_sendRequestWithCompleteUrlStr:completeUrlStr\n                                               method:methodStr\n                                           parameters:parameters\n                                            loadCache:loadCache\n                                        cacheDuration:cacheDuration\n                                     requestIdentifer:requestIdentifer\n                                              success:successBlock\n                                              failure:failureBlock];\n                \n            }\n            \n        }];\n        \n    }else {\n        \n        SJLog(@\"=========== Do not need to load cache, start sending network request...\");\n        [self p_sendRequestWithCompleteUrlStr:completeUrlStr\n                                       method:methodStr\n                                   parameters:parameters\n                                    loadCache:loadCache\n                                cacheDuration:cacheDuration\n                             requestIdentifer:requestIdentifer\n                                      success:successBlock\n                                      failure:failureBlock];\n        \n    }\n}\n\n\n\n\n#pragma mark- ============== Private Methods ==============\n\n\n- (void)p_sendRequestWithCompleteUrlStr:(NSString *)completeUrlStr\n                                 method:(NSString *)methodStr\n                             parameters:(id)parameters\n                              loadCache:(BOOL)loadCache\n                          cacheDuration:(NSTimeInterval)cacheDuration\n                       requestIdentifer:(NSString *)requestIdentifer\n                                success:(SJSuccessBlock)successBlock\n                                failure:(SJFailureBlock)failureBlock{\n    \n    //add customed headers\n    [self addCustomHeaders];\n    \n    \n    //add default parameters\n    NSDictionary * completeParameters = [self addDefaultParametersWithCustomParameters:parameters];\n    \n    \n    //create corresponding request model\n    SJNetworkRequestModel *requestModel = [[SJNetworkRequestModel alloc] init];\n    requestModel.requestUrl = completeUrlStr;\n    requestModel.method = methodStr;\n    requestModel.parameters = completeParameters;\n    requestModel.loadCache = loadCache;\n    requestModel.cacheDuration = cacheDuration;\n    requestModel.requestIdentifer = requestIdentifer;\n    requestModel.successBlock = successBlock;\n    requestModel.failureBlock = failureBlock;\n    \n    \n    //create a session task corresponding to a request model\n    NSError * __autoreleasing requestSerializationError = nil;\n    NSURLSessionDataTask *dataTask = [self p_dataTaskWithRequestModel:requestModel\n                                                    requestSerializer:_sessionManager.requestSerializer\n                                                                error:&requestSerializationError];\n    \n    \n    //save task info request model\n    requestModel.task = dataTask;\n    \n    //save this request model into request set\n    [[SJNetworkRequestPool sharedPool] addRequestModel:requestModel];\n    \n    if (_isDebugMode) {\n        SJLog(@\"=========== Start requesting...\\n =========== url:%@\\n =========== method:%@\\n =========== parameters:%@\",completeUrlStr,methodStr,completeParameters);\n    }\n    \n    \n    //start request\n    [dataTask resume];\n    \n}\n\n\n\n- (NSURLSessionDataTask *)p_dataTaskWithRequestModel:(SJNetworkRequestModel *)requestModel\n                                 requestSerializer:(AFHTTPRequestSerializer *)requestSerializer\n                                             error:(NSError * _Nullable __autoreleasing *)error{\n    \n    //create request\n    NSMutableURLRequest *request = [requestSerializer requestWithMethod:requestModel.method\n                                                              URLString:requestModel.requestUrl\n                                                             parameters:requestModel.parameters\n                                                                  error:error];\n    \n\n  \n    //create data task\n    __weak __typeof(self) weakSelf = self;\n    NSURLSessionDataTask * dataTask = [_sessionManager dataTaskWithRequest:request\n                                                            uploadProgress:nil\n                                                          downloadProgress:nil\n                                                         completionHandler:^(NSURLResponse * _Nonnull response, id  _Nullable responseObject, NSError * _Nullable error){\n                                                \n                                      [weakSelf p_handleRequestModel:requestModel responseObject:responseObject error:error];\n                                  }];\n    \n    return dataTask;\n    \n}\n\n\n\n\n- (void)p_handleRequestModel:(SJNetworkRequestModel *)requestModel\n              responseObject:(id)responseObject\n                       error:(NSError *)error{\n    \n    NSError *requestError = nil;\n    BOOL requestSucceed = YES;\n    \n    //check request state\n    if (error) {\n        requestSucceed = NO;\n        requestError = error;\n    }\n    \n    if (requestSucceed) {\n        \n        //request succeed\n        requestModel.responseObject = responseObject;\n        [self requestDidSucceedWithRequestModel:requestModel];\n        \n    } else {\n        \n        //request failed\n        [self requestDidFailedWithRequestModel:requestModel error:requestError];\n    }\n    \n    dispatch_async(dispatch_get_main_queue(), ^{\n        \n        [self handleRequesFinished:requestModel];\n        \n    });\n    \n}\n\n\n\n\n- (NSString *)p_methodStringFromRequestMethod:(SJRequestMethod)method{\n    \n    switch (method) {\n            \n        case SJRequestMethodGET:{\n            return @\"GET\";\n        }\n            break;\n            \n        case SJRequestMethodPOST:{\n            return  @\"POST\";\n        }\n            break;\n            \n        case SJRequestMethodPUT:{\n            return  @\"PUT\";\n        }\n            break;\n            \n        case SJRequestMethodDELETE:{\n            return  @\"DELETE\";\n        }\n            break;\n    }\n}\n\n\n#pragma mark- ============== Override Methods ==============\n\n\n- (void)requestDidSucceedWithRequestModel:(SJNetworkRequestModel *)requestModel{\n    \n    //write cache\n    if (requestModel.cacheDuration > 0) {\n        \n        requestModel.responseData = [NSJSONSerialization dataWithJSONObject:requestModel.responseObject options:NSJSONWritingPrettyPrinted error:nil];\n        \n        if (requestModel.responseData) {\n            \n            [_cacheManager writeCacheWithReqeustModel:requestModel asynchronously:YES];\n            \n        }else{\n            SJLog(@\"=========== Failded to write cache, since something was wrong when transfering response data\");\n        }\n        \n        \n    }\n    \n    dispatch_async(dispatch_get_main_queue(), ^{\n        \n        if (_isDebugMode) {\n            SJLog(@\"=========== Request succeed! \\n =========== Request url:%@\\n =========== Response object:%@\", requestModel.requestUrl,requestModel.responseObject);\n        }\n        \n        if (requestModel.successBlock) {\n            requestModel.successBlock(requestModel.responseObject);\n        }\n    });\n    \n}\n\n\n- (void)requestDidFailedWithRequestModel:(SJNetworkRequestModel *)requestModel error:(NSError *)error{\n    \n    \n    dispatch_async(dispatch_get_main_queue(), ^{\n        \n        if (_isDebugMode) {\n            SJLog(@\"=========== Request failded! \\n =========== Request model:%@ \\n =========== NSError object:%@ \\n =========== Status code:%ld\",requestModel,error,(long)error.code);\n        }\n        \n        if (requestModel.failureBlock){\n            requestModel.failureBlock(requestModel.task, error, error.code);\n        }\n        \n    });\n}\n\n\n\n\n- (id)addDefaultParametersWithCustomParameters:(id)parameters{\n    \n    //if there is default parameters, then add them into custom parameters\n    id parameters_spliced = nil;\n    \n    if (parameters && [parameters isKindOfClass:[NSDictionary class]]) {\n        \n        if ([[[SJNetworkConfig sharedConfig].defailtParameters allKeys] count] > 0) {\n            \n            NSMutableDictionary *defaultParameters_m = [[SJNetworkConfig sharedConfig].defailtParameters mutableCopy];\n            [defaultParameters_m addEntriesFromDictionary:parameters];\n            parameters_spliced = [defaultParameters_m copy];\n            \n        }else{\n            \n            parameters_spliced = parameters;\n        }\n        \n    }else{\n        \n        parameters_spliced = [SJNetworkConfig sharedConfig].defailtParameters;\n        \n    }\n    \n    return parameters_spliced;\n}\n\n\n- (void)addCustomHeaders{\n    \n    //add custom header\n    NSDictionary *customHeaders = [SJNetworkConfig sharedConfig].customHeaders;\n    if ([customHeaders allKeys] > 0) {\n        \n        NSArray *allKeys = [customHeaders allKeys];\n        if ([allKeys count] >0) {\n            [customHeaders enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString *value, BOOL * _Nonnull stop) {\n                [_sessionManager.requestSerializer setValue:value forHTTPHeaderField:key];\n                if (_isDebugMode) {\n                    SJLog(@\"=========== added header:key:%@ value:%@\",key,value);\n                }\n            }];\n        }\n    }\n}\n\n\n\n#pragma mark- ============== SJNetworkProtocol ==============\n\n- (void)handleRequesFinished:(SJNetworkRequestModel *)requestModel{\n    \n    //clear all blocks\n    [requestModel clearAllBlocks];\n    \n    //remove this requst model from request queue\n    [[SJNetworkRequestPool sharedPool] removeRequestModel:requestModel];\n    \n}\n\n\n\n\n@end\n"
  },
  {
    "path": "SJNetwork/SJNetworkRequestModel.h",
    "content": "//\n//  SJNetworkRequestModel.h\n//  SJNetwork\n//\n//  Created by Sun Shijie on 2017/8/17.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n#import <UIKit/UIKit.h>\n#import \"SJNetworkHeader.h\"\n\n\n@interface SJNetworkRequestModel : NSObject\n\n\n//Unique identifier of a request\n@property (nonatomic, readwrite, copy)   NSString *requestIdentifer;\n\n\n//Task of a request (NSURLSessionDataTask or NSURLSessionDownloadTask)\n@property (nonatomic, readwrite, strong) NSURLSessionTask *task;\n\n\n//NSHTTPURLResponse object\n@property (nonatomic, readwrite, strong) NSURLResponse *response;\n\n\n//Request url\n@property (nonatomic, readwrite, copy)   NSString *requestUrl;\n\n\n//If ignore baseUrl(which is set in SJNetworkConfig singleton instance)\n@property (nonatomic, readwrite, assign) BOOL ignoreBaseUrl;\n\n\n//Request method\n@property (nonatomic, readwrite, copy)   NSString *method;\n\n\n//Response object\n@property (nonatomic, readwrite, strong) id responseObject;\n\n\n\n//============== Only for ordinary request(GET,POST,PUT,DELETE) ==================//\n\n@property (nonatomic, readwrite, strong) id parameters;                             //parameters(request body)\n@property (nonatomic, readwrite, assign) BOOL loadCache;                            //if load cache(default is NO)\n@property (nonatomic, readwrite, assign) NSTimeInterval cacheDuration;              //if write cache(when bigger than 0, write cache;otherwise don't)\n@property (nonatomic, readwrite, strong) NSData *responseData;                      //response data of an ordinary request\n\n@property (nonatomic, readwrite, copy)   SJSuccessBlock successBlock;\n@property (nonatomic, readwrite, copy)   SJFailureBlock failureBlock;\n\n\n\n\n//============== Only for upload request ==================//\n\n@property (nonatomic, readwrite, copy)   NSString *uploadUrl;                        //target upload url\n@property (nonatomic, readwrite, copy)   NSArray<UIImage *> *uploadImages;           //upload images(or image)array\n@property (nonatomic, readwrite, copy)   NSString *imagesIdentifer;                  //identifier of upload image\n@property (nonatomic, readwrite, copy)   NSString *mimeType;                         //mime type of upload file\n@property (nonatomic, readwrite, assign) float imageCompressRatio;                   //compress ratio of all upload images, default is 1(original)\n@property (nonatomic, readonly, copy)    NSString *cacheDataFilePath;                //cache data file path\n@property (nonatomic, readonly, copy)    NSString *cacheDataInfoFilePath;            //cache data info file path(record info of corresponding cache data)\n\n\n@property (nonatomic, readwrite, copy)   SJUploadSuccessBlock uploadSuccessBlock;\n@property (nonatomic, readwrite, copy)   SJUploadProgressBlock uploadProgressBlock;\n@property (nonatomic, readwrite, copy)   SJUploadFailureBlock uploadFailedBlock;\n\n\n\n\n//============== Only for download request ==================//\n\n@property (nonatomic, readwrite, copy)   NSString *downloadFilePath;                  // target download file path\n@property (nonatomic, readwrite, assign) BOOL resumableDownload;                      // if support resumable download, default is YES\n@property (nonatomic, readwrite, assign) BOOL backgroundDownloadSupport;              // if support background download, default is NO\n@property (nonatomic, readwrite, strong) NSOutputStream *stream;                      // stream used to save download data\n@property (nonatomic, readwrite, assign) NSInteger totalLength;                       // total length of download file\n@property (nonatomic, readonly, copy)    NSString *resumeDataFilePath;                // resume data file path\n@property (nonatomic, readonly, copy)    NSString *resumeDataInfoFilePath;            // resume data info file path\n@property (nonatomic, readwrite, assign) SJDownloadManualOperation manualOperation;   // requst operation by user\n\n@property (nonatomic, readwrite, copy)   SJDownloadSuccessBlock downloadSuccessBlock;\n@property (nonatomic, readwrite, copy)   SJDownloadProgressBlock downloadProgressBlock;\n@property (nonatomic, readwrite, copy)   SJDownloadFailureBlock downloadFailureBlock;\n\n\n\n\n/**\n *  This method is used to return request type of this request\n *\n *  @return requestType               request type of this request\n */\n- (SJRequestType)requestType;\n\n\n\n/**\n *  This method is used to return the file path of cache data file\n *\n *  @return cacheDataFilePath         file path of cache data file\n */\n- (NSString *)cacheDataFilePath;\n\n\n\n\n/**\n *  This method is used to return the file path of cache info data file\n *\n *  @return cacheDataInfoFilePath     file path of cache info data file\n */\n- (NSString *)cacheDataInfoFilePath;\n\n\n\n\n/**\n *  This method is used to return the download resume data file path of this request （useful only if this is a download request）\n *\n *  @return resumeDataFilePath        file path of download resume data\n */\n- (NSString *)resumeDataFilePath;\n\n\n\n\n/**\n *  This method is used to return the download resume data info file path of this request（useful only if this is a download request）\n *\n *  @return resumeDataInfoFilePath    file path of download resume data info\n */\n- (NSString *)resumeDataInfoFilePath;\n\n\n\n\n/**\n *  This method is used to clear all callback blocks\n */\n- (void)clearAllBlocks;\n\n\n\n@end\n"
  },
  {
    "path": "SJNetwork/SJNetworkRequestModel.m",
    "content": "//\n//  SJNetworkRequestModel.m\n//  SJNetwork\n//\n//  Created by Sun Shijie on 2017/8/17.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"SJNetworkRequestModel.h\"\n#import \"SJNetworkConfig.h\"\n#import \"SJNetworkUtils.h\"\n\n@interface SJNetworkRequestModel()\n\n@property (nonatomic, readwrite, copy) NSString *cacheDataFilePath;\n@property (nonatomic, readwrite, copy) NSString *cacheDataInfoFilePath;\n\n@property (nonatomic, readwrite, copy) NSString *resumeDataFilePath;\n@property (nonatomic, readwrite, copy) NSString *resumeDataInfoFilePath;\n\n@end\n\n\n@implementation SJNetworkRequestModel\n\n#pragma mark- ============== Public Methods ==============\n\n\n- (SJRequestType)requestType{\n    \n    if (self.downloadFilePath){\n        \n        return SJRequestTypeDownload;\n        \n    }else if(self.uploadUrl){\n        \n        return SJRequestTypeUpload;\n        \n    }else{\n        \n        return SJRequestTypeOrdinary;\n        \n    }\n}\n\n\n\n\n- (NSString *)cacheDataFilePath{\n    \n    if (self.requestType == SJRequestTypeOrdinary) {\n        \n        if (_cacheDataFilePath.length > 0) {\n            \n            return _cacheDataFilePath;\n            \n        }else{\n            \n            _cacheDataFilePath = [SJNetworkUtils cacheDataFilePathWithRequestIdentifer:_requestIdentifer];\n            return _cacheDataFilePath;\n        }\n        \n    }else{\n        \n        return nil;\n    }\n    \n}\n\n\n\n\n- (NSString *)cacheDataInfoFilePath{\n    \n    \n    if (self.requestType == SJRequestTypeOrdinary) {\n        \n        if (_cacheDataInfoFilePath.length > 0) {\n            \n            return _cacheDataInfoFilePath;\n            \n        }else{\n            \n            _cacheDataInfoFilePath = [SJNetworkUtils cacheDataInfoFilePathWithRequestIdentifer:_requestIdentifer];\n            return _cacheDataInfoFilePath;\n        }\n        \n    }else{\n        \n        return nil;\n    }\n    \n}\n\n\n\n\n\n- (NSString *)resumeDataFilePath{\n    \n    if (self.requestType == SJRequestTypeDownload) {\n        \n        if (_resumeDataFilePath.length > 0) {\n            \n            return _resumeDataFilePath;\n            \n        }else{\n            \n            _resumeDataFilePath = [SJNetworkUtils resumeDataFilePathWithRequestIdentifer:_requestIdentifer downloadFileName:_downloadFilePath.lastPathComponent];\n            return _resumeDataFilePath;\n        }\n        \n    }else{\n        \n        return nil;\n        \n    }\n}\n\n\n\n\n- (NSString *)resumeDataInfoFilePath{\n    \n    if (self.requestType == SJRequestTypeDownload) {\n        \n        if (_resumeDataInfoFilePath.length > 0) {\n            \n            return _resumeDataInfoFilePath;\n            \n        }else{\n            \n            _resumeDataInfoFilePath = [SJNetworkUtils resumeDataInfoFilePathWithRequestIdentifer:_requestIdentifer];\n            return _resumeDataInfoFilePath;\n        }\n        \n    }else{\n        \n        return nil;\n        \n    }\n    \n}\n\n\n\n\n\n- (void)clearAllBlocks{\n    \n    _successBlock = nil;\n    _failureBlock = nil;\n    \n    _uploadProgressBlock = nil;\n    _uploadSuccessBlock = nil;\n    _uploadFailedBlock = nil;\n    \n    _downloadProgressBlock = nil;\n    _downloadSuccessBlock = nil;\n    _downloadFailureBlock= nil;\n    \n}\n\n\n#pragma mark- ============== Override Methods ==============\n\n- (NSString *)description{\n    \n    if ([SJNetworkConfig sharedConfig].debugMode) {\n        \n        switch (self.requestType) {\n                \n            case SJRequestTypeOrdinary:\n                return [NSString stringWithFormat:@\"\\n{\\n   <%@: %p>\\n   type:            oridnary request\\n   method:          %@\\n   url:             %@\\n   parameters:      %@\\n   loadCache:       %@\\n   cacheDuration:   %@ seconds\\n   requestIdentifer:%@\\n   task:            %@\\n}\" ,NSStringFromClass([self class]),self,_method,_requestUrl,_parameters,_loadCache?@\"YES\":@\"NO\",[NSNumber numberWithInteger:_cacheDuration],_requestIdentifer,_task];\n                break;\n                \n            case SJRequestTypeUpload:\n                return [NSString stringWithFormat:@\"\\n{\\n   <%@: %p>\\n   type:            upload request\\n   method:          %@\\n   url:             %@\\n   parameters:      %@\\n   images:          %@\\n    requestIdentifer:%@\\n   task:            %@\\n}\" ,NSStringFromClass([self class]),self,_method,_requestUrl,_parameters,_uploadImages,_requestIdentifer,_task];\n                break;\n                \n            case SJRequestTypeDownload:\n                return [NSString stringWithFormat:@\"\\n{\\n   <%@: %p>\\n   type:            download request\\n   method:          %@\\n   url:             %@\\n   parameters:      %@\\n   target path:     %@\\n    requestIdentifer:%@\\n   task:            %@\\n}\" ,NSStringFromClass([self class]),self,_method,_requestUrl,_parameters,_downloadFilePath,_requestIdentifer,_task];\n                break;\n                \n            default:\n                [NSString stringWithFormat:@\"\\n  request type:unkown request type\\n  request object:%@\",self];\n                break;\n        }\n        \n        \n    }else{\n        \n         return [NSString stringWithFormat:@\"<%@: %p>\" ,NSStringFromClass([self class]),self];\n    }\n}\n\n@end\n"
  },
  {
    "path": "SJNetwork/SJNetworkRequestPool.h",
    "content": "//\n//  SJNetworkRequestPool.h\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/25.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n\n\n@class SJNetworkRequestModel;\n\n\n/* =============================\n *\n * SJNetworkRequestPool\n *\n * SJNetworkRequestPool is in charge of managing current requests (holding request models,\n *  add or remove request models, cancel current requests etc)\n *\n * =============================\n */\n\n\n/**\n *  SJCurrentRequestModels: A dictionary which is used to hold all current request models\n */\ntypedef NSMutableDictionary<NSString *, SJNetworkRequestModel *> SJCurrentRequestModels;\n\n\n@interface SJNetworkRequestPool : NSObject\n\n\n//============================= Initialization =============================//\n\n\n/**\n *  SJNetworkRequestPool Singleton\n *\n *  @return SJNetworkRequestPool singleton instance\n */\n+ (SJNetworkRequestPool *_Nonnull)sharedPool;\n\n\n\n//============================= Requests Management =============================//\n\n/**\n *  This method is used to return all current request models\n *\n *  @return currentRequestModels    all current request models set(NSDictionary)\n */\n- (SJCurrentRequestModels *_Nonnull)currentRequestModels;\n\n\n\n\n/**\n *  This method is used to add a request model into current request models set\n */\n- (void)addRequestModel:(SJNetworkRequestModel *_Nonnull)requestModel;\n\n\n\n/**\n *  This method is used to remove a request model from current request models set\n */\n- (void)removeRequestModel:(SJNetworkRequestModel *_Nonnull)requestModel;\n\n\n\n\n/**\n *  This method is used to exchange a new request model with an old one\n */\n- (void)changeRequestModel:(SJNetworkRequestModel *_Nonnull)requestModel forKey:(NSString *_Nonnull)key;\n\n\n\n//============================= Requests Info =============================//\n\n\n\n/**\n *  This method is used to check if there is remaining curent request\n *\n *  @return if there is remaining requests\n */\n- (BOOL)remainingCurrentRequests;\n\n\n\n/**\n *  This method is used to calculate the count of current requests\n *\n *  @return the count of current requests\n */\n- (NSInteger)currentRequestCount;\n\n\n\n\n/**\n *  This method is used to log all current requests' information\n */\n- (void)logAllCurrentRequests;\n\n\n\n\n\n//============================= Cancel requests =============================//\n\n\n/**\n *  This method is used to cancel all current requests\n */\n- (void)cancelAllCurrentRequests;\n\n\n\n\n\n/**\n *  This method is used to cancel all current requests corresponding a reqeust url,\n *  no matter what the method is and parameters are\n *\n *  @param url              request url\n *\n */\n- (void)cancelCurrentRequestWithUrl:(NSString * _Nonnull)url;\n\n\n\n\n\n/**\n *  This method is used to cancel all current requests corresponding given reqeust urls,\n *  no matter what the method is and parameters are\n *\n *  @param urls              request url\n *\n */\n- (void)cancelCurrentRequestWithUrls:(NSArray * _Nonnull)urls;\n\n\n\n\n\n\n/**\n *  This method is used to cancel all current requests corresponding a specific reqeust url, method and parameters\n *\n *  @param url              request url\n *  @param method           request method\n *  @param parameters       parameters\n *\n */\n- (void)cancelCurrentRequestWithUrl:(NSString * _Nonnull)url\n                             method:(NSString * _Nonnull)method\n                         parameters:(id _Nullable)parameters;\n\n\n\n@end\n"
  },
  {
    "path": "SJNetwork/SJNetworkRequestPool.m",
    "content": "//\n//  SJNetworkRequestPool.m\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/25.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"SJNetworkRequestPool.h\"\n#import \"SJNetworkUtils.h\"\n#import \"SJNetworkConfig.h\"\n#import \"SJNetworkRequestModel.h\"\n#import \"SJNetworkProtocol.h\"\n\n#import \"objc/runtime.h\"\n#import <CommonCrypto/CommonDigest.h>\n#import <pthread/pthread.h>\n\n\n#define Lock() pthread_mutex_lock(&_lock)\n#define Unlock() pthread_mutex_unlock(&_lock)\n\nstatic char currentRequestModelsKey;\n\n@interface SJNetworkRequestModel()<SJNetworkProtocol>\n\n@end\n\n@implementation SJNetworkRequestPool\n{\n    pthread_mutex_t _lock;\n    BOOL _isDebugMode;\n}\n\n\n#pragma mark- ============== Life Cycle ==============\n\n+ (SJNetworkRequestPool *)sharedPool {\n    \n    static SJNetworkRequestPool *sharedPool = NULL;\n    static dispatch_once_t onceToken;\n    \n    dispatch_once(&onceToken, ^{\n        sharedPool = [[SJNetworkRequestPool alloc] init];\n    });\n    return sharedPool;\n}\n\n\n\n- (instancetype)init {\n    \n    self = [super init];\n    if (self) {\n        \n        //lock\n        pthread_mutex_init(&_lock, NULL);\n        \n        //debug mode or not\n        _isDebugMode = [SJNetworkConfig sharedConfig].debugMode;\n        \n    }\n    return self;\n}\n\n#pragma mark- ============== Public Methods ==============\n\n- (SJCurrentRequestModels *)currentRequestModels {\n    \n    SJCurrentRequestModels *currentTasks = objc_getAssociatedObject(self, &currentRequestModelsKey);\n    if (currentTasks) {\n        return currentTasks;\n    }\n    currentTasks = [NSMutableDictionary dictionary];\n    objc_setAssociatedObject(self, &currentRequestModelsKey, currentTasks, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n    return currentTasks;\n}\n\n\n\n- (void)addRequestModel:(SJNetworkRequestModel *)requestModel{\n    \n    Lock();\n    [self.currentRequestModels setObject:requestModel forKey:[NSString stringWithFormat:@\"%ld\",(unsigned long)requestModel.task.taskIdentifier]];\n    Unlock();\n}\n\n\n\n- (void)removeRequestModel:(SJNetworkRequestModel *)requestModel{\n    \n    Lock();\n    [self.currentRequestModels removeObjectForKey:[NSString stringWithFormat:@\"%ld\",(unsigned long)requestModel.task.taskIdentifier]];\n    Unlock();\n    \n}\n\n\n\n- (void)changeRequestModel:(SJNetworkRequestModel *_Nonnull)requestModel forKey:(NSString *_Nonnull)key{\n    \n    Lock();\n    [self.currentRequestModels removeObjectForKey:key];\n    [self.currentRequestModels setObject:requestModel forKey:[NSString stringWithFormat:@\"%ld\",(unsigned long)requestModel.task.taskIdentifier]];\n    Unlock();\n    \n}\n\n\n\n- (BOOL)remainingCurrentRequests{\n    \n    NSArray *keys = [self.currentRequestModels  allKeys];\n    if ([keys count]>0) {\n        SJLog(@\"=========== There is remaining current request\");\n        return YES;\n    }\n    SJLog(@\"=========== There is no remaining current request\");\n    return NO;\n}\n\n\n\n\n- (NSInteger)currentRequestCount{\n    \n    if(![self remainingCurrentRequests]){\n        return 0;\n    }\n    \n    NSArray *keys = [self.currentRequestModels allKeys];\n    SJLog(@\"=========== There is %ld current requests\",(unsigned long)keys.count);\n    return [keys count];\n    \n}\n\n\n\n\n\n- (void)logAllCurrentRequests{\n    \n    if ([self remainingCurrentRequests]) {\n        \n        [self.currentRequestModels enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, SJNetworkRequestModel * _Nonnull requestModel, BOOL * _Nonnull stop) {\n            SJLog(@\"=========== Log current request:\\n %@\",requestModel);\n        }];\n        \n    }\n}\n\n\n\n\n\n- (void)cancelAllCurrentRequests{\n    \n    if ([self remainingCurrentRequests]) {\n        \n        for (SJNetworkRequestModel *requestModel in [self.currentRequestModels allValues]) {\n            \n        \n            if (requestModel.requestType == SJRequestTypeDownload) {\n                \n                if (requestModel.backgroundDownloadSupport) {\n                    \n                    NSURLSessionDownloadTask *downloadTask = (NSURLSessionDownloadTask*)requestModel.task;\n                    [downloadTask cancelByProducingResumeData:^(NSData * _Nullable resumeData) {\n                    }];\n                    \n                }else{\n                    \n                    [requestModel.task cancel];\n                }\n                \n            }else{\n                \n                [requestModel.task cancel];\n                [self removeRequestModel:requestModel];\n            }\n        }\n        SJLog(@\"=========== Canceled call current requests\");\n    }\n    \n    \n}\n\n\n\n\n\n- (void)cancelCurrentRequestWithUrl:(NSString * _Nonnull)url{\n    \n    if(![self remainingCurrentRequests]){\n        return;\n    }\n    \n    NSMutableArray *cancelRequestModelsArr = [NSMutableArray arrayWithCapacity:2];\n    NSString *requestIdentiferOfUrl =  [SJNetworkUtils generateMD5StringFromString: [NSString stringWithFormat:@\"Url:%@\",url]];\n    \n    [self.currentRequestModels enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, SJNetworkRequestModel * _Nonnull requestModel, BOOL * _Nonnull stop) {\n        \n        if ([requestModel.requestIdentifer containsString:requestIdentiferOfUrl]) {\n            [cancelRequestModelsArr addObject:requestModel];\n        }\n    }];\n    \n    if ([cancelRequestModelsArr count] == 0) {\n        \n        SJLog(@\"=========== There is no request to be canceled\");\n        \n    }else {\n        \n        if (_isDebugMode) {\n            SJLog(@\"=========== Requests to be canceled:\");\n            [cancelRequestModelsArr enumerateObjectsUsingBlock:^(SJNetworkRequestModel *requestModel, NSUInteger idx, BOOL * _Nonnull stop) {\n                SJLog(@\"=========== cancel request with url[%ld]:%@\",(unsigned long)idx,requestModel.requestUrl);\n            }];\n        }\n        \n        [cancelRequestModelsArr enumerateObjectsUsingBlock:^(SJNetworkRequestModel *requestModel, NSUInteger idx, BOOL * _Nonnull stop) {\n            \n            \n            if (requestModel.requestType == SJRequestTypeDownload) {\n                \n                if (requestModel.backgroundDownloadSupport) {\n                    NSURLSessionDownloadTask *downloadTask = (NSURLSessionDownloadTask*)requestModel.task;\n                    \n                    if (requestModel.task.state == NSURLSessionTaskStateCompleted) {\n                        \n                        SJLog(@\"=========== Canceled background support download request:%@\",requestModel);\n                        NSError *error = [NSError errorWithDomain:@\"Request has been canceled\" code:0 userInfo:nil];\n                        \n                        dispatch_async(dispatch_get_main_queue(), ^{\n                            \n                            if (requestModel.downloadFailureBlock) {\n                                requestModel.downloadFailureBlock(requestModel.task, error,requestModel.resumeDataFilePath);\n                            }\n                            [self handleRequesFinished:requestModel];\n                        });\n                        \n                    }else{\n                        \n                        [downloadTask cancelByProducingResumeData:^(NSData * _Nullable resumeData) {\n                            \n                        }];\n                        SJLog(@\"=========== Background support download request %@ has been canceled\",requestModel);\n                    }\n                    \n                }else{\n                    \n                    [requestModel.task cancel];\n                    SJLog(@\"=========== Request %@ has been canceled\",requestModel);\n                }\n                \n            }else{\n                \n                [requestModel.task cancel];\n                SJLog(@\"=========== Request %@ has been canceled\",requestModel);\n                if (requestModel.requestType != SJRequestTypeDownload) {\n                    [self removeRequestModel:requestModel];\n                }\n            }\n        }];\n        \n        SJLog(@\"=========== All requests with request url : '%@' are canceled\",url);\n    }\n    \n    \n}\n\n\n\n\n- (void)cancelCurrentRequestWithUrls:(NSArray * _Nonnull)urls{\n    \n    if ([urls count] == 0) {\n        SJLog(@\"=========== There is no input urls!\");\n        return;\n    }\n    \n    if(![self remainingCurrentRequests]){\n        return;\n    }\n    \n    [urls enumerateObjectsUsingBlock:^(NSString *url, NSUInteger idx, BOOL * _Nonnull stop) {\n        [self cancelCurrentRequestWithUrl:url];\n    }];\n}\n\n\n\n\n\n\n- (void)cancelCurrentRequestWithUrl:(NSString * _Nonnull)url\n                             method:(NSString * _Nonnull)method\n                         parameters:(id _Nullable)parameter{\n    \n    if(![self remainingCurrentRequests]){\n        return;\n    }\n    \n    NSString *requestIdentifier = [SJNetworkUtils generateRequestIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                           requestUrlStr:url\n                                                                               methodStr:method\n                                                                              parameters:parameter];\n    \n    [self p_cancelRequestWithRequestIdentifier:requestIdentifier];\n}\n\n\n\n#pragma mark- ============== Private Methods ==============\n\n- (void)p_cancelRequestWithRequestIdentifier:(NSString *)requestIdentifier{\n    \n    [self.currentRequestModels enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, SJNetworkRequestModel * _Nonnull requestModel, BOOL * _Nonnull stop) {\n        \n        if ([requestModel.requestIdentifer isEqualToString:requestIdentifier]) {\n            \n            if (requestModel.task) {\n                \n                [requestModel.task cancel];\n                SJLog(@\"=========== Canceled request:%@\",requestModel);\n                if (requestModel.requestType != SJRequestTypeDownload) {\n                    [self removeRequestModel:requestModel];\n                }\n                \n            }else {\n                SJLog(@\"=========== There is no task of this request\");\n            }\n        }\n    }];\n}\n\n\n\n\n#pragma mark- ============== SJNetworkProtocol ==============\n\n- (void)handleRequesFinished:(SJNetworkRequestModel *)requestModel{\n    \n    //clear all blocks\n    [requestModel clearAllBlocks];\n    \n    //remove this requst model from request queue\n    [[SJNetworkRequestPool sharedPool] removeRequestModel:requestModel];\n    \n}\n\n\n\n\n\n@end\n"
  },
  {
    "path": "SJNetwork/SJNetworkUploadEngine.h",
    "content": "//\n//  SJNetworkUploadManager.h\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/26.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n#import \"SJNetworkBaseEngine.h\"\n\n\n/* =============================\n *\n * SJNetworkUploadEngine\n *\n * SJNetworkUploadEngine is in charge of upload image or images.\n *\n * =============================\n */\n\n\n@interface SJNetworkUploadEngine : SJNetworkBaseEngine\n\n\n//========================= Request API upload images ==========================//\n\n\n/**\n *  This method offers the most number of parameters of a certain upload request.\n *\n *  @note:\n *        1. All the other upload image API will call this method.\n *\n *        2. If 'ignoreBaseUrl' is set to be YES, the base url which is holden by\n *           SJNetworkConfig will be ignored, so the 'url' will be the complete request\n *           url of this request.(default is set to be NO)\n *\n *        3. 'name' is the name of image(or images). When uploading more than one\n *           image, a new unique name of one single image will be generated in method\n *           implementation.\n *\n *  @param url                   request url\n *  @param ignoreBaseUrl         consider whether to ignore configured base url\n *  @param parameters            parameters\n *  @param images                UIImage object array\n *  @param compressRatio         compress ratio of images\n *  @param name                  file name\n *  @param mimeType              file type\n *  @param uploadProgressBlock   upload progress callback\n *  @param uploadSuccessBlock    upload success callback\n *  @param uploadFailureBlock    upload failure callback\n *\n */\n- (void)sendUploadImagesRequest:(NSString * _Nonnull)url\n                  ignoreBaseUrl:(BOOL)ignoreBaseUrl\n                     parameters:(id _Nullable)parameters\n                         images:(NSArray<UIImage *> * _Nonnull)images\n                  compressRatio:(float)compressRatio\n                           name:(NSString * _Nonnull)name\n                       mimeType:(NSString * _Nullable)mimeType\n                       progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                        success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                        failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock;\n\n\n\n\n@end\n"
  },
  {
    "path": "SJNetwork/SJNetworkUploadEngine.m",
    "content": "//\n//  SJNetworkUploadManager.m\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/26.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"SJNetworkUploadEngine.h\"\n#import \"SJNetworkRequestPool.h\"\n#import \"SJNetworkConfig.h\"\n#import \"SJNetworkUtils.h\"\n#import \"SJNetworkProtocol.h\"\n\n@interface SJNetworkUploadEngine()<SJNetworkProtocol>\n\n@property (nonatomic, strong) AFHTTPSessionManager *sessionManager;\n\n@end\n\n@implementation SJNetworkUploadEngine\n{\n     BOOL _isDebugMode;\n}\n\n#pragma mark- ============== Life Cycle ==============\n\n\n- (instancetype)init{\n    \n    self = [super init];\n    if (self) {\n        \n        //debug mode or not\n        _isDebugMode = [SJNetworkConfig sharedConfig].debugMode;\n        \n        //AFSessionManager config\n        _sessionManager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];\n        \n        //RequestSerializer\n        _sessionManager.requestSerializer = [AFJSONRequestSerializer serializer];\n        _sessionManager.requestSerializer.allowsCellularAccess = YES;\n        \n        _sessionManager.requestSerializer.timeoutInterval = [SJNetworkConfig sharedConfig].timeoutSeconds;\n        \n\n        //securityPolicy\n        _sessionManager.securityPolicy = [AFSecurityPolicy defaultPolicy];\n        [_sessionManager.securityPolicy setAllowInvalidCertificates:YES];\n        _sessionManager.securityPolicy.validatesDomainName = NO;\n        \n        //ResponseSerializer\n        _sessionManager.responseSerializer = [AFJSONResponseSerializer serializer];\n        _sessionManager.responseSerializer.acceptableContentTypes=[[NSSet alloc] initWithObjects:@\"application/xml\", @\"text/xml\",@\"text/html\", @\"application/json\",@\"text/plain\",nil];\n        \n        //Queue\n        _sessionManager.completionQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);\n        _sessionManager.operationQueue.maxConcurrentOperationCount = 5;\n        \n        \n    }\n    return self;\n}\n\n\n#pragma mark- ============== Public Methods ==============\n\n- (void)sendUploadImagesRequest:(NSString * _Nonnull)url\n                  ignoreBaseUrl:(BOOL)ignoreBaseUrl\n                     parameters:(id _Nullable)parameters\n                         images:(NSArray<UIImage *> * _Nonnull)images\n                  compressRatio:(float)compressRatio\n                           name:(NSString * _Nonnull)name\n                       mimeType:(NSString * _Nullable)mimeType\n                       progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                        success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                        failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock{\n    \n    //if images count equals 0, then return\n    if ([images count] == 0) {\n        SJLog(@\"=========== Upload image failed:There is no image to upload!\");\n        return;\n    }\n\n    \n    //default method is POST\n    NSString *methodStr = @\"POST\";\n    \n    //generate full request url\n    NSString *completeUrlStr = nil;\n    \n    //generate a unique identifer of a spectific request\n    NSString *requestIdentifer = nil;\n    \n    if (ignoreBaseUrl) {\n        \n        completeUrlStr   = url;\n        requestIdentifer = [SJNetworkUtils generateRequestIdentiferWithBaseUrlStr:nil\n                                                                   requestUrlStr:url\n                                                                       methodStr:methodStr\n                                                                      parameters:parameters];\n    }else{\n        \n        completeUrlStr   = [[SJNetworkConfig sharedConfig].baseUrl stringByAppendingPathComponent:url];\n        requestIdentifer = [SJNetworkUtils generateRequestIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                   requestUrlStr:url\n                                                                       methodStr:methodStr\n                                                                      parameters:parameters];\n    }\n    \n    //add custom headers\n    [self addCustomHeaders];\n    \n    //add default parameters\n    NSDictionary * completeParameters = [self addDefaultParametersWithCustomParameters:parameters];\n    \n    //create corresponding request model and send request with it\n    SJNetworkRequestModel *requestModel = [[SJNetworkRequestModel alloc] init];\n    requestModel.requestUrl = completeUrlStr;\n    requestModel.uploadUrl = url;\n    requestModel.method = methodStr;\n    requestModel.parameters = completeParameters;\n    requestModel.uploadImages = images;\n    requestModel.imageCompressRatio = compressRatio;\n    requestModel.imagesIdentifer = name;\n    requestModel.mimeType = mimeType;\n    requestModel.requestIdentifer = requestIdentifer;\n    requestModel.uploadSuccessBlock = uploadSuccessBlock;\n    requestModel.uploadProgressBlock = uploadProgressBlock;\n    requestModel.uploadFailedBlock = uploadFailureBlock;\n    \n    [self p_sendUploadImagesRequestWithRequestModel:requestModel];\n}\n\n\n\n#pragma mark- ============== Private Methods ==============\n\n- (void)p_sendUploadImagesRequestWithRequestModel:(SJNetworkRequestModel *)requestModel{\n    \n    \n    if (_isDebugMode) {\n        SJLog(@\"=========== Start upload request with url:%@...\",requestModel.requestUrl);\n    }\n    \n    __weak __typeof(self) weakSelf = self;\n    NSURLSessionDataTask *uploadTask = [_sessionManager POST:requestModel.requestUrl\n                                                  parameters:requestModel.parameters\n                                   constructingBodyWithBlock:^(id<AFMultipartFormData>  _Nonnull formData) {\n                                       \n                                       [requestModel.uploadImages enumerateObjectsUsingBlock:^(UIImage * _Nonnull image, NSUInteger idx, BOOL * _Nonnull stop) {\n                                           \n                                           //image compress ratio\n                                           float ratio = requestModel.imageCompressRatio;\n                                           if (ratio > 1 || ratio < 0) {\n                                               ratio = 1;\n                                           }\n                                           \n                                           //image data\n                                           NSData *imageData = nil;\n                                           \n                                           //image type\n                                           NSString *imageType = nil;\n                                           \n                                           if ([requestModel.mimeType isEqualToString:@\"png\"] || [requestModel.mimeType isEqualToString:@\"PNG\"]  ) {\n                                               \n                                               imageData = UIImagePNGRepresentation(image);\n                                               imageType = @\"png\";\n                                               \n                                           }else if ([requestModel.mimeType isEqualToString:@\"jpg\"] || [requestModel.mimeType isEqualToString:@\"JPG\"] ){\n                                               \n                                               imageData = UIImageJPEGRepresentation(image, ratio);\n                                               imageType = @\"jpg\";\n                                               \n                                           }else if ([requestModel.mimeType isEqualToString:@\"jpeg\"] || [requestModel.mimeType isEqualToString:@\"JPEG\"] ){\n                                               \n                                               imageData = UIImageJPEGRepresentation(image, ratio);\n                                               imageType = @\"jpeg\";\n                                               \n                                           }else{\n                                               imageData = UIImageJPEGRepresentation(image, ratio);\n                                               imageType = @\"jpg\";\n                                           }\n                                           \n                                                                                      \n                                           long index = idx;\n                                           NSTimeInterval interval = [[NSDate date] timeIntervalSince1970];\n                                           long long totalMilliseconds = interval * 1000;\n                                           \n                                           //file name should be unique\n                                           NSString *fileName = [NSString stringWithFormat:@\"%lld.%@\", totalMilliseconds,imageType];\n                                           \n                                           //name should be unique\n                                           NSString *identifer = [NSString stringWithFormat:@\"%@%ld\", requestModel.imagesIdentifer, index];\n                                           \n                                           \n                                           [formData appendPartWithFileData:imageData\n                                                                       name:identifer\n                                                                   fileName:fileName\n                                                                   mimeType:[NSString stringWithFormat:@\"image/%@\",imageType]];\n                                       }];\n                                       \n                                   } progress:^(NSProgress * _Nonnull uploadProgress) {\n                                       \n                                       if (_isDebugMode){\n                                           SJLog(@\"=========== Upload image progress:%@\",uploadProgress);\n                                       }\n                                       \n                                       dispatch_async(dispatch_get_main_queue(), ^{\n                                         if (requestModel.uploadProgressBlock) {\n                                             requestModel.uploadProgressBlock(uploadProgress);\n                                         }\n                                           \n                                       });\n                                       \n                                   } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {\n                                       \n                                       if (_isDebugMode){\n                                          SJLog(@\"=========== Upload image request succeed:%@\\n =========== Successfully uploaded images:%@\",responseObject,requestModel.uploadImages);\n                                       }\n                                           \n                                       dispatch_async(dispatch_get_main_queue(), ^{\n                                           \n                                         if (requestModel.uploadSuccessBlock) {                                             \n                                             requestModel.uploadSuccessBlock(responseObject);\n                                         }\n                                           \n                                         [weakSelf handleRequesFinished:requestModel];\n                                           \n                                       });\n                                       \n                                       \n                                   } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {\n                                       \n                                       \n                                       if (_isDebugMode){\n                                           SJLog(@\"=========== Upload images request failed: \\n =========== error:%@\\n =========== status code:%ld\\n =========== failed images:%@:\",error,(long)error.code,requestModel.uploadImages);\n                                       }\n                                       \n                                        dispatch_async(dispatch_get_main_queue(), ^{\n                                            \n                                           if (requestModel.uploadFailedBlock) {\n                                               requestModel.uploadFailedBlock(task, error,error.code,requestModel.uploadImages);\n                                            }\n                                           [weakSelf handleRequesFinished:requestModel];\n                                            \n                                        });\n                                      \n                                   }];\n    \n    requestModel.task = uploadTask;\n    [[SJNetworkRequestPool sharedPool] addRequestModel:requestModel];\n\n}\n\n\n\n\n#pragma mark- ============== Override Methods ==============\n\n- (id)addDefaultParametersWithCustomParameters:(id)parameters{\n    \n    //if there is default parameters, then add them into custom parameters\n    id parameters_spliced = nil;\n    \n    if (parameters && [parameters isKindOfClass:[NSDictionary class]]) {\n        \n        if ([[[SJNetworkConfig sharedConfig].defailtParameters allKeys] count] > 0) {\n            \n            NSMutableDictionary *defaultParameters_m = [[SJNetworkConfig sharedConfig].defailtParameters mutableCopy];\n            [defaultParameters_m addEntriesFromDictionary:parameters];\n            parameters_spliced = [defaultParameters_m copy];\n            \n        }else{\n            \n            parameters_spliced = parameters;\n        }\n        \n    }else{\n        \n        parameters_spliced = [SJNetworkConfig sharedConfig].defailtParameters;\n        \n    }\n    \n    return parameters_spliced;\n}\n\n\n\n- (void)addCustomHeaders{\n    \n    //add custom header\n    NSDictionary *customHeaders = [SJNetworkConfig sharedConfig].customHeaders;\n    if ([customHeaders allKeys] > 0) {\n        NSArray *allKeys = [customHeaders allKeys];\n        if ([allKeys count] >0) {\n            [customHeaders enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString *value, BOOL * _Nonnull stop) {\n                [_sessionManager.requestSerializer setValue:value forHTTPHeaderField:key];\n                if (_isDebugMode) {\n                  SJLog(@\"=========== added header:key:%@ value:%@\",key,value);\n                }\n            }];\n        }\n    }\n}\n\n\n\n#pragma mark- ============== SJNetworkProtocol ==============\n\n- (void)handleRequesFinished:(SJNetworkRequestModel *)requestModel{\n    \n    //clear all blocks\n    [requestModel clearAllBlocks];\n    \n    //remove this requst model from request queue\n    [[SJNetworkRequestPool sharedPool] removeRequestModel:requestModel];\n}\n\n\n@end\n"
  },
  {
    "path": "SJNetwork/SJNetworkUtils.h",
    "content": "//\n//  SJNetworkUtils.h\n//  SJNetwork\n//\n//  Created by Sun Shijie on 2017/8/17.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n\n\n/* =============================\n *\n * SJNetworkUtils\n *\n * SJNetworkUtils is in charge of some operation of string or generate information\n *\n * =============================\n */\n\nextern NSString * _Nonnull const SJNetworkCacheBaseFolderName;\nextern NSString * _Nonnull const SJNetworkCacheFileSuffix;\nextern NSString * _Nonnull const SJNetworkCacheInfoFileSuffix;\nextern NSString * _Nonnull const SJNetworkDownloadResumeDataInfoFileSuffix;\n\n\n@interface SJNetworkUtils : NSObject\n\n\n/**\n *  This method is used to return app version\n *\n *  @return app version string\n */\n+ (NSString * _Nullable)appVersionStr;\n\n\n\n/**\n *  This method is used to generate the md5 string of given string\n *\n *  @param string                       original string\n *\n *  @return the transformed md5 string\n */\n+ (NSString * _Nonnull)generateMD5StringFromString:(NSString *_Nonnull)string;\n\n\n\n\n/**\n *  This method is used to generate complete request url\n *\n *  @param baseUrlStr                   base url\n *  @param requestUrlStr                request url\n *\n *  @return the complete request url\n */\n+ (NSString *_Nonnull)generateCompleteRequestUrlStrWithBaseUrlStr:(NSString *_Nonnull)baseUrlStr requestUrlStr:(NSString *_Nonnull)requestUrlStr;\n\n\n\n\n\n/**\n *  This method is used to generate partial identifier of more than one request\n *\n *  @param baseUrlStr                   base url\n *  @param requestUrlStr                request url\n *  @param methodStr                       request method\n *\n *  @return the unique identifier  of a specific request\n */\n+ (NSString *_Nonnull)generatePartialIdentiferWithBaseUrlStr:(NSString * _Nonnull)baseUrlStr\n                                               requestUrlStr:(NSString * _Nullable)requestUrlStr\n                                                   methodStr:(NSString * _Nullable)methodStr;\n\n\n\n\n\n/**\n *  This method is used to generate unique identifier of a specific request\n *\n *  @param baseUrlStr                   base url\n *  @param requestUrlStr                request url\n *  @param methodStr                    request method\n *  @param parameters                   parameters (can be nil)\n *\n *  @return the unique identifier  of a specific request\n */\n+ (NSString *_Nonnull)generateRequestIdentiferWithBaseUrlStr:(NSString * _Nullable)baseUrlStr\n                                               requestUrlStr:(NSString * _Nullable)requestUrlStr\n                                                   methodStr:(NSString * _Nullable)methodStr\n                                                  parameters:(id _Nullable)parameters;\n\n\n\n/**\n *  This method is used to generate unique identifier of a download request\n *\n *  @param baseUrlStr                   base url\n *  @param requestUrlStr                request url\n *\n *  @return the unique identifier of a download request\n */\n+ (NSString * _Nonnull)generateDownloadRequestIdentiferWithBaseUrlStr:(NSString * _Nullable)baseUrlStr requestUrlStr:(NSString * _Nonnull)requestUrlStr;\n\n\n\n\n/**\n *  This method is used to create a folder of a given folder name\n *\n *  @param folderName                   folder name\n *\n *  @return the full path of the new folder\n */\n+ (NSString * _Nonnull)createBasePathWithFolderName:(NSString * _Nonnull)folderName;\n\n\n\n\n\n/**\n *  This method is used to create cache base folder path\n *\n *\n *  @return the base cache  folder path\n */\n+ (NSString * _Nonnull)createCacheBasePath;\n\n\n\n\n/**\n *  This method is used to return the cache data file path of the given requestIdentifer\n *\n *  @param requestIdentifer     the unique identier of a specific  network request\n *\n *  @return the cache data file path\n */\n+ (NSString * _Nonnull)cacheDataFilePathWithRequestIdentifer:(NSString * _Nonnull)requestIdentifer;\n\n\n\n\n\n/**\n *  This method is used to return the cache data file path of the given requestIdentifer\n *\n *  @param requestIdentifer     the unique identier of a specific  network request\n *\n *  @return the cache data file path\n */\n+ (NSString * _Nonnull)cacheDataInfoFilePathWithRequestIdentifer:(NSString * _Nonnull)requestIdentifer;\n\n\n\n\n\n/**\n *  This method is used to return resume data file path of the given requestIdentifer\n *\n *  @param requestIdentifer     the unique identier of a specific  network request\n *  @param downloadFileName     the download file name (the last path component of a complete download request url)\n *\n *  @return resume data file path\n */\n+ (NSString * _Nonnull)resumeDataFilePathWithRequestIdentifer:(NSString * _Nonnull)requestIdentifer downloadFileName:(NSString * _Nonnull)downloadFileName;\n\n\n\n\n/**\n *  This method is used to return the resume data info file path of the given requestIdentifer\n *\n *  @param requestIdentifer     the unique identier of a specific  network request\n *\n *  @return the resume data info file path\n */\n+ (NSString * _Nonnull)resumeDataInfoFilePathWithRequestIdentifer:(NSString * _Nonnull)requestIdentifer;\n\n\n\n\n/**\n *  This method is used to check the availability of given data\n *\n *  @param data                 NSData object (can be a cache data of cache info data etc.)\n *\n *  @return the availability of a given data\n */\n+ (BOOL)availabilityOfData:(NSData * _Nonnull)data;\n\n\n\n\n\n/**\n *  This method is used to generate image file type string of a certain image data\n *\n *  @param imageData            image data\n *\n *  @return image file type\n */\n+ (NSString * _Nullable)imageFileTypeForImageData:(NSData * _Nonnull)imageData;\n\n\n@end\n"
  },
  {
    "path": "SJNetwork/SJNetworkUtils.m",
    "content": "//\n//  SJNetworkUtils.m\n//  SJNetwork\n//\n//  Created by Sun Shijie on 2017/8/17.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"SJNetworkUtils.h\"\n#import <CommonCrypto/CommonDigest.h>\n\n\n#define CC_MD5_DIGEST_LENGTH    16          /* digest length in bytes */\n#define CC_MD5_BLOCK_BYTES      64          /* block size in bytes */\n#define CC_MD5_BLOCK_LONG       (CC_MD5_BLOCK_BYTES / sizeof(CC_LONG))\n\n\n\nNSString * const SJNetworkCacheBaseFolderName = @\"SJNetworkCache\";\nNSString * const SJNetworkCacheFileSuffix = @\"cacheData\";\nNSString * const SJNetworkCacheInfoFileSuffix = @\"cacheInfo\";\nNSString * const SJNetworkDownloadResumeDataInfoFileSuffix = @\"resumeInfo\";\n\n\n@implementation SJNetworkUtils\n\n\n#pragma mark- ============== Public Methods ==============\n\n\n\n+ (NSString * _Nullable)appVersionStr{\n    \n    return [[[NSBundle mainBundle] infoDictionary] objectForKey:@\"CFBundleShortVersionString\"];\n}\n\n\n+ (NSString * _Nonnull)generateMD5StringFromString:(NSString * _Nonnull)string {\n    \n    NSParameterAssert(string != nil && [string length] > 0);\n    \n    const char *value = [string UTF8String];\n    \n    unsigned char outputBuffer[CC_MD5_DIGEST_LENGTH];\n    CC_MD5(value, (CC_LONG)strlen(value), outputBuffer);\n    \n    NSMutableString *outputString = [[NSMutableString alloc] initWithCapacity:CC_MD5_DIGEST_LENGTH * 2];\n    for(NSInteger count = 0; count < CC_MD5_DIGEST_LENGTH; count++){\n        [outputString appendFormat:@\"%02x\",outputBuffer[count]];\n    }\n    \n    return outputString;\n}\n\n\n+ (NSString * _Nonnull)generateCompleteRequestUrlStrWithBaseUrlStr:(NSString * _Nonnull)baseUrlStr requestUrlStr:(NSString * _Nonnull)requestUrlStr{\n    \n    NSURL *requestUrl = [NSURL URLWithString:requestUrlStr];\n    \n    if (requestUrl && requestUrl.host && requestUrl.scheme) {\n        return requestUrlStr;\n    }\n    \n    NSURL *url = [NSURL URLWithString:baseUrlStr];\n    \n    if (baseUrlStr.length > 0 && ![baseUrlStr hasSuffix:@\"/\"]) {\n        url = [url URLByAppendingPathComponent:@\"\"];\n    }\n    \n    return [NSURL URLWithString:requestUrlStr relativeToURL:url].absoluteString;\n    \n}\n\n\n+ (NSString *_Nonnull)generatePartialIdentiferWithBaseUrlStr:(NSString * _Nonnull)baseUrlStr\n                                               requestUrlStr:(NSString * _Nullable)requestUrlStr\n                                                   methodStr:(NSString * _Nullable)methodStr{\n    \n    NSString *url_md5 =           nil;\n    NSString *method_md5 =        nil;\n    NSString *partialIdentifier = nil;\n    \n    NSString *host_md5 =         [self generateMD5StringFromString: [NSString stringWithFormat:@\"Host:%@\",baseUrlStr]];\n    \n    if (requestUrlStr.length == 0 && methodStr.length == 0) {\n        \n        partialIdentifier = [NSString stringWithFormat:@\"%@\",host_md5];\n        \n    }else if (requestUrlStr.length > 0 && methodStr.length == 0) {\n        \n        url_md5 =          [self generateMD5StringFromString: [NSString stringWithFormat:@\"Url:%@\",requestUrlStr]];\n        partialIdentifier = [NSString stringWithFormat:@\"%@_%@\",host_md5,url_md5];\n        \n    }else if (requestUrlStr.length > 0 && methodStr.length > 0){\n        \n        url_md5 =          [self generateMD5StringFromString: [NSString stringWithFormat:@\"Url:%@\",requestUrlStr]];\n        method_md5 =          [self generateMD5StringFromString: [NSString stringWithFormat:@\"Method:%@\",methodStr]];\n        partialIdentifier = [NSString stringWithFormat:@\"%@_%@_%@\",host_md5,url_md5,method_md5];\n        \n    }\n    \n    return partialIdentifier;\n}\n\n\n+ (NSString * _Nonnull)generateRequestIdentiferWithBaseUrlStr:(NSString * _Nullable)baseUrlStr\n                                                requestUrlStr:(NSString * _Nullable)requestUrlStr\n                                                    methodStr:(NSString * _Nullable)methodStr\n                                                   parameters:(id _Nullable)parameters{\n    \n    NSString *host_md5 =         [self generateMD5StringFromString: [NSString stringWithFormat:@\"Host:%@\",baseUrlStr]];\n    NSString *url_md5 =          [self generateMD5StringFromString: [NSString stringWithFormat:@\"Url:%@\",requestUrlStr]];\n    NSString *method_md5 =       [self generateMD5StringFromString: [NSString stringWithFormat:@\"Method:%@\",methodStr]];\n    \n    NSString *paramsStr = @\"\";\n    NSString *parameters_md5 = @\"\";\n    \n    if (parameters) {\n        paramsStr =        [self p_convertJsonStringFromDictionaryOrArray:parameters];\n        parameters_md5 =   [self generateMD5StringFromString: [NSString stringWithFormat:@\"Parameters:%@\",paramsStr]];\n    }\n    \n    NSString *requestIdentifer = [NSString stringWithFormat:@\"%@_%@_%@_%@\",host_md5,url_md5,method_md5,parameters_md5];\n    \n    return requestIdentifer;\n    \n}\n\n\n+ (NSString * _Nonnull)generateDownloadRequestIdentiferWithBaseUrlStr:(NSString * _Nullable)baseUrlStr requestUrlStr:(NSString * _Nonnull)requestUrlStr{\n\n    NSString *host_md5 =         [self generateMD5StringFromString: [NSString stringWithFormat:@\"Host:%@\",baseUrlStr]];\n    NSString *url_md5 =          [self generateMD5StringFromString: [NSString stringWithFormat:@\"Url:%@\",requestUrlStr]];\n\n    NSString *requestIdentifer = [NSString stringWithFormat:@\"%@_%@_\",host_md5,url_md5];\n\n    return requestIdentifer;\n\n}\n\n\n\n+ (NSString * _Nonnull)createBasePathWithFolderName:(NSString * _Nonnull)folderName{\n    \n    NSString *pathOfCache = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0];\n    NSString *path = [pathOfCache stringByAppendingPathComponent:folderName];\n    [self p_createDirectoryIfNeeded:path];\n    return path;\n    \n}\n\n\n\n\n+ (NSString * _Nonnull)createCacheBasePath{\n    \n    return [self createBasePathWithFolderName:SJNetworkCacheBaseFolderName];\n}\n\n\n\n\n+ (NSString * _Nonnull)cacheDataFilePathWithRequestIdentifer:(NSString * _Nonnull)requestIdentifer{\n    \n    if (requestIdentifer.length > 0) {\n        \n        NSString *cacheFileName = [NSString stringWithFormat:@\"%@.%@\", requestIdentifer,SJNetworkCacheFileSuffix];\n        NSString *cacheFilePath = [[self createCacheBasePath] stringByAppendingPathComponent:cacheFileName];\n        return cacheFilePath;\n        \n    }else{\n        \n        return nil;\n        \n    }\n}\n\n\n\n\n+ (NSString * _Nonnull)cacheDataInfoFilePathWithRequestIdentifer:(NSString * _Nonnull)requestIdentifer{\n    \n    if (requestIdentifer.length > 0) {\n        \n        NSString *cacheInfoFileName = [NSString stringWithFormat:@\"%@.%@\", requestIdentifer,SJNetworkCacheInfoFileSuffix];\n        NSString *cacheInfoFilePath = [[self createCacheBasePath] stringByAppendingPathComponent:cacheInfoFileName];\n        return cacheInfoFilePath;\n        \n    }else{\n        \n        return nil;\n        \n    }\n    \n}\n\n\n\n\n+ (NSString * _Nonnull)resumeDataFilePathWithRequestIdentifer:(NSString * _Nonnull)requestIdentifer downloadFileName:(NSString * _Nonnull)downloadFileName{\n    \n    NSString *dataFileName = [NSString stringWithFormat:@\"%@.%@\", requestIdentifer, downloadFileName];\n    NSString * resumeDataFilePath = [[self createCacheBasePath] stringByAppendingPathComponent:dataFileName];\n    return resumeDataFilePath;\n}\n\n\n\n\n\n+ (NSString * _Nonnull)resumeDataInfoFilePathWithRequestIdentifer:(NSString * _Nonnull)requestIdentifer{\n    \n    NSString * dataInfoFileName = [NSString stringWithFormat:@\"%@.%@\", requestIdentifer,SJNetworkDownloadResumeDataInfoFileSuffix];\n    NSString * resumeDataInfoFilePath = [[self createCacheBasePath] stringByAppendingPathComponent:dataInfoFileName];\n    return resumeDataInfoFilePath;\n}\n\n\n\n\n+ (BOOL)availabilityOfData:(NSData * _Nonnull)data{\n    \n    if (!data || [data length] < 1) return NO;\n    \n    NSError *error;\n    NSDictionary *resumeDictionary = [NSPropertyListSerialization propertyListWithData:data options:NSPropertyListImmutable format:NULL error:&error];\n    \n    if (!resumeDictionary || error) return NO;\n    \n    // Before iOS 9 & Mac OS X 10.11\n#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED < 90000)\\\n|| (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED < 101100)\n    NSString *localFilePath = [resumeDictionary objectForKey:@\"NSURLSessionResumeInfoLocalPath\"];\n    if ([localFilePath length] < 1) return NO;\n    return [[NSFileManager defaultManager] fileExistsAtPath:localFilePath];\n#endif\n    return YES;\n}\n\n\n+ (NSString * _Nullable)imageFileTypeForImageData:(NSData * _Nonnull)imageData{\n    \n    uint8_t c;\n    [imageData getBytes:&c length:1];\n    switch (c) {\n        case 0xFF:\n            return @\"jpeg\";\n        case 0x89:\n            return @\"png\";\n        case 0x47:\n            return @\"gif\";\n        case 0x49:\n        case 0x4D:\n            return @\"tiff\";\n        case 0x52:\n            if ([imageData length] < 12) {\n                return nil;\n            }\n            NSString *testString = [[NSString alloc] initWithData:[imageData subdataWithRange:NSMakeRange(0, 12)] encoding:NSASCIIStringEncoding];\n            if ([testString hasPrefix:@\"RIFF\"] && [testString hasSuffix:@\"WEBP\"]) {\n                return @\"webp\";\n            }\n            return nil;\n    }\n    return nil;\n}\n\n#pragma mark- ============== Private Methods ==============\n\n\n+ (NSString *)p_convertJsonStringFromDictionaryOrArray:(id)parameter {\n    \n    NSData *data = [NSJSONSerialization dataWithJSONObject:parameter\n                                                   options:NSJSONWritingPrettyPrinted\n                                                     error:nil];\n    \n    NSString *jsonStr = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];\n    return jsonStr;\n}\n\n\n\n\n+ (void)p_createDirectoryIfNeeded:(NSString *)path {\n    \n    NSFileManager *fileManager = [NSFileManager defaultManager];\n    BOOL isDir;\n    \n    if (![fileManager fileExistsAtPath:path isDirectory:&isDir]) {\n        \n        [self p_createBaseDirectoryAtPath:path];\n        \n    } else {\n        \n        if (!isDir) {\n            \n            NSError *error = nil;\n            [fileManager removeItemAtPath:path error:&error];\n            [self p_createBaseDirectoryAtPath:path];\n        }\n    }\n}\n\n\n\n\n+ (void)p_createBaseDirectoryAtPath:(NSString *)path {\n\n    [[NSFileManager defaultManager] createDirectoryAtPath:path\n                              withIntermediateDirectories:YES\n                                               attributes:nil\n                                                    error:nil];\n}\n\n\n\n\n\n@end\n"
  },
  {
    "path": "SJNetwork.podspec",
    "content": "\nPod::Spec.new do |s|\n\n\n  s.name         = \"SJNetwork\"\n  s.version      = \"1.2.0\"\n  s.summary      = \"SJNetwork is a high level network request tool based on AFNetworking.\"\n  s.homepage     = \"https://github.com/knightsj/SJNetwork\"\n  s.license      = \"MIT\"\n  s.author       = { \"Sun Shijie\" => \"ssjlife0111@163.com\" }\n  s.source       = { :git => \"https://github.com/knightsj/SJNetwork.git\", :tag => s.version.to_s }\n  s.source_files = 'SJNetwork/**/*.{h,m}'\n  s.requires_arc = true\n\n  s.ios.deployment_target = \"8.0\"\n  # s.osx.deployment_target = \"10.11\"\n  # s.watchos.deployment_target = \"2.0\"\n  # s.tvos.deployment_target = \"9.0\"\n\n  s.framework   = \"UIKit\"\n  s.dependency \"AFNetworking\", \"~> 3.0\"\n\n\n\nend\n"
  },
  {
    "path": "SJNetworkDemo/Podfile",
    "content": "platform :ios, '8.0'\n\ntarget 'SJNetworkingDemo' do\npod 'AFNetworking', '~> 3.0'\nend"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/AFNetworking/AFHTTPSessionManager.h",
    "content": "// AFHTTPSessionManager.h\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import <Foundation/Foundation.h>\n#if !TARGET_OS_WATCH\n#import <SystemConfiguration/SystemConfiguration.h>\n#endif\n#import <TargetConditionals.h>\n\n#if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV\n#import <MobileCoreServices/MobileCoreServices.h>\n#else\n#import <CoreServices/CoreServices.h>\n#endif\n\n#import \"AFURLSessionManager.h\"\n\n/**\n `AFHTTPSessionManager` is a subclass of `AFURLSessionManager` with convenience methods for making HTTP requests. When a `baseURL` is provided, requests made with the `GET` / `POST` / et al. convenience methods can be made with relative paths.\n\n ## Subclassing Notes\n\n Developers targeting iOS 7 or Mac OS X 10.9 or later that deal extensively with a web service are encouraged to subclass `AFHTTPSessionManager`, providing a class method that returns a shared singleton object on which authentication and other configuration can be shared across the application.\n\n For developers targeting iOS 6 or Mac OS X 10.8 or earlier, `AFHTTPRequestOperationManager` may be used to similar effect.\n\n ## Methods to Override\n\n To change the behavior of all data task operation construction, which is also used in the `GET` / `POST` / et al. convenience methods, override `dataTaskWithRequest:completionHandler:`.\n\n ## Serialization\n\n Requests created by an HTTP client will contain default headers and encode parameters according to the `requestSerializer` property, which is an object conforming to `<AFURLRequestSerialization>`.\n\n Responses received from the server are automatically validated and serialized by the `responseSerializers` property, which is an object conforming to `<AFURLResponseSerialization>`\n\n ## URL Construction Using Relative Paths\n\n For HTTP convenience methods, the request serializer constructs URLs from the path relative to the `-baseURL`, using `NSURL +URLWithString:relativeToURL:`, when provided. If `baseURL` is `nil`, `path` needs to resolve to a valid `NSURL` object using `NSURL +URLWithString:`.\n\n Below are a few examples of how `baseURL` and relative paths interact:\n\n    NSURL *baseURL = [NSURL URLWithString:@\"http://example.com/v1/\"];\n    [NSURL URLWithString:@\"foo\" relativeToURL:baseURL];                  // http://example.com/v1/foo\n    [NSURL URLWithString:@\"foo?bar=baz\" relativeToURL:baseURL];          // http://example.com/v1/foo?bar=baz\n    [NSURL URLWithString:@\"/foo\" relativeToURL:baseURL];                 // http://example.com/foo\n    [NSURL URLWithString:@\"foo/\" relativeToURL:baseURL];                 // http://example.com/v1/foo\n    [NSURL URLWithString:@\"/foo/\" relativeToURL:baseURL];                // http://example.com/foo/\n    [NSURL URLWithString:@\"http://example2.com/\" relativeToURL:baseURL]; // http://example2.com/\n\n Also important to note is that a trailing slash will be added to any `baseURL` without one. This would otherwise cause unexpected behavior when constructing URLs using paths without a leading slash.\n\n @warning Managers for background sessions must be owned for the duration of their use. This can be accomplished by creating an application-wide or shared singleton instance.\n */\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface AFHTTPSessionManager : AFURLSessionManager <NSSecureCoding, NSCopying>\n\n/**\n The URL used to construct requests from relative paths in methods like `requestWithMethod:URLString:parameters:`, and the `GET` / `POST` / et al. convenience methods.\n */\n@property (readonly, nonatomic, strong, nullable) NSURL *baseURL;\n\n/**\n Requests created with `requestWithMethod:URLString:parameters:` & `multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:` are constructed with a set of default headers using a parameter serialization specified by this property. By default, this is set to an instance of `AFHTTPRequestSerializer`, which serializes query string parameters for `GET`, `HEAD`, and `DELETE` requests, or otherwise URL-form-encodes HTTP message bodies.\n\n @warning `requestSerializer` must not be `nil`.\n */\n@property (nonatomic, strong) AFHTTPRequestSerializer <AFURLRequestSerialization> * requestSerializer;\n\n/**\n Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to an instance of `AFJSONResponseSerializer`.\n\n @warning `responseSerializer` must not be `nil`.\n */\n@property (nonatomic, strong) AFHTTPResponseSerializer <AFURLResponseSerialization> * responseSerializer;\n\n///---------------------\n/// @name Initialization\n///---------------------\n\n/**\n Creates and returns an `AFHTTPSessionManager` object.\n */\n+ (instancetype)manager;\n\n/**\n Initializes an `AFHTTPSessionManager` object with the specified base URL.\n\n @param url The base URL for the HTTP client.\n\n @return The newly-initialized HTTP client\n */\n- (instancetype)initWithBaseURL:(nullable NSURL *)url;\n\n/**\n Initializes an `AFHTTPSessionManager` object with the specified base URL.\n\n This is the designated initializer.\n\n @param url The base URL for the HTTP client.\n @param configuration The configuration used to create the managed session.\n\n @return The newly-initialized HTTP client\n */\n- (instancetype)initWithBaseURL:(nullable NSURL *)url\n           sessionConfiguration:(nullable NSURLSessionConfiguration *)configuration NS_DESIGNATED_INITIALIZER;\n\n///---------------------------\n/// @name Making HTTP Requests\n///---------------------------\n\n/**\n Creates and runs an `NSURLSessionDataTask` with a `GET` request.\n\n @param URLString The URL string used to create the request URL.\n @param parameters The parameters to be encoded according to the client request serializer.\n @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.\n @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.\n\n @see -dataTaskWithRequest:completionHandler:\n */\n- (nullable NSURLSessionDataTask *)GET:(NSString *)URLString\n                   parameters:(nullable id)parameters\n                      success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success\n                      failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;\n\n\n/**\n Creates and runs an `NSURLSessionDataTask` with a `GET` request.\n\n @param URLString The URL string used to create the request URL.\n @param parameters The parameters to be encoded according to the client request serializer.\n @param downloadProgress A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue.\n @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.\n @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.\n\n @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:\n */\n- (nullable NSURLSessionDataTask *)GET:(NSString *)URLString\n                            parameters:(nullable id)parameters\n                              progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgress\n                               success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success\n                               failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;\n\n/**\n Creates and runs an `NSURLSessionDataTask` with a `HEAD` request.\n\n @param URLString The URL string used to create the request URL.\n @param parameters The parameters to be encoded according to the client request serializer.\n @param success A block object to be executed when the task finishes successfully. This block has no return value and takes a single arguments: the data task.\n @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.\n\n @see -dataTaskWithRequest:completionHandler:\n */\n- (nullable NSURLSessionDataTask *)HEAD:(NSString *)URLString\n                    parameters:(nullable id)parameters\n                       success:(nullable void (^)(NSURLSessionDataTask *task))success\n                       failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;\n\n/**\n Creates and runs an `NSURLSessionDataTask` with a `POST` request.\n\n @param URLString The URL string used to create the request URL.\n @param parameters The parameters to be encoded according to the client request serializer.\n @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.\n @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.\n\n @see -dataTaskWithRequest:completionHandler:\n */\n- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString\n                    parameters:(nullable id)parameters\n                       success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success\n                       failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;\n\n/**\n Creates and runs an `NSURLSessionDataTask` with a `POST` request.\n\n @param URLString The URL string used to create the request URL.\n @param parameters The parameters to be encoded according to the client request serializer.\n @param uploadProgress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue.\n @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.\n @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.\n\n @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:\n */\n- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString\n                             parameters:(nullable id)parameters\n                               progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress\n                                success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success\n                                failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;\n\n/**\n Creates and runs an `NSURLSessionDataTask` with a multipart `POST` request.\n\n @param URLString The URL string used to create the request URL.\n @param parameters The parameters to be encoded according to the client request serializer.\n @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol.\n @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.\n @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.\n\n @see -dataTaskWithRequest:completionHandler:\n */\n- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString\n                    parameters:(nullable id)parameters\n     constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block\n                       success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success\n                       failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;\n\n/**\n Creates and runs an `NSURLSessionDataTask` with a multipart `POST` request.\n\n @param URLString The URL string used to create the request URL.\n @param parameters The parameters to be encoded according to the client request serializer.\n @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol.\n @param uploadProgress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue.\n @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.\n @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.\n\n @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:\n */\n- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString\n                             parameters:(nullable id)parameters\n              constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block\n                               progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress\n                                success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success\n                                failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;\n\n/**\n Creates and runs an `NSURLSessionDataTask` with a `PUT` request.\n\n @param URLString The URL string used to create the request URL.\n @param parameters The parameters to be encoded according to the client request serializer.\n @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.\n @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.\n\n @see -dataTaskWithRequest:completionHandler:\n */\n- (nullable NSURLSessionDataTask *)PUT:(NSString *)URLString\n                   parameters:(nullable id)parameters\n                      success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success\n                      failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;\n\n/**\n Creates and runs an `NSURLSessionDataTask` with a `PATCH` request.\n\n @param URLString The URL string used to create the request URL.\n @param parameters The parameters to be encoded according to the client request serializer.\n @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.\n @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.\n\n @see -dataTaskWithRequest:completionHandler:\n */\n- (nullable NSURLSessionDataTask *)PATCH:(NSString *)URLString\n                     parameters:(nullable id)parameters\n                        success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success\n                        failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;\n\n/**\n Creates and runs an `NSURLSessionDataTask` with a `DELETE` request.\n\n @param URLString The URL string used to create the request URL.\n @param parameters The parameters to be encoded according to the client request serializer.\n @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.\n @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.\n\n @see -dataTaskWithRequest:completionHandler:\n */\n- (nullable NSURLSessionDataTask *)DELETE:(NSString *)URLString\n                      parameters:(nullable id)parameters\n                         success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success\n                         failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/AFNetworking/AFHTTPSessionManager.m",
    "content": "// AFHTTPSessionManager.m\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import \"AFHTTPSessionManager.h\"\n\n#import \"AFURLRequestSerialization.h\"\n#import \"AFURLResponseSerialization.h\"\n\n#import <Availability.h>\n#import <TargetConditionals.h>\n#import <Security/Security.h>\n\n#import <netinet/in.h>\n#import <netinet6/in6.h>\n#import <arpa/inet.h>\n#import <ifaddrs.h>\n#import <netdb.h>\n\n#if TARGET_OS_IOS || TARGET_OS_TV\n#import <UIKit/UIKit.h>\n#elif TARGET_OS_WATCH\n#import <WatchKit/WatchKit.h>\n#endif\n\n@interface AFHTTPSessionManager ()\n@property (readwrite, nonatomic, strong) NSURL *baseURL;\n@end\n\n@implementation AFHTTPSessionManager\n@dynamic responseSerializer;\n\n+ (instancetype)manager {\n    return [[[self class] alloc] initWithBaseURL:nil];\n}\n\n- (instancetype)init {\n    return [self initWithBaseURL:nil];\n}\n\n- (instancetype)initWithBaseURL:(NSURL *)url {\n    return [self initWithBaseURL:url sessionConfiguration:nil];\n}\n\n- (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration {\n    return [self initWithBaseURL:nil sessionConfiguration:configuration];\n}\n\n- (instancetype)initWithBaseURL:(NSURL *)url\n           sessionConfiguration:(NSURLSessionConfiguration *)configuration\n{\n    self = [super initWithSessionConfiguration:configuration];\n    if (!self) {\n        return nil;\n    }\n\n    // Ensure terminal slash for baseURL path, so that NSURL +URLWithString:relativeToURL: works as expected\n    if ([[url path] length] > 0 && ![[url absoluteString] hasSuffix:@\"/\"]) {\n        url = [url URLByAppendingPathComponent:@\"\"];\n    }\n\n    self.baseURL = url;\n\n    self.requestSerializer = [AFHTTPRequestSerializer serializer];\n    self.responseSerializer = [AFJSONResponseSerializer serializer];\n\n    return self;\n}\n\n#pragma mark -\n\n- (void)setRequestSerializer:(AFHTTPRequestSerializer <AFURLRequestSerialization> *)requestSerializer {\n    NSParameterAssert(requestSerializer);\n\n    _requestSerializer = requestSerializer;\n}\n\n- (void)setResponseSerializer:(AFHTTPResponseSerializer <AFURLResponseSerialization> *)responseSerializer {\n    NSParameterAssert(responseSerializer);\n\n    [super setResponseSerializer:responseSerializer];\n}\n\n#pragma mark -\n\n- (NSURLSessionDataTask *)GET:(NSString *)URLString\n                   parameters:(id)parameters\n                      success:(void (^)(NSURLSessionDataTask *task, id responseObject))success\n                      failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure\n{\n\n    return [self GET:URLString parameters:parameters progress:nil success:success failure:failure];\n}\n\n- (NSURLSessionDataTask *)GET:(NSString *)URLString\n                   parameters:(id)parameters\n                     progress:(void (^)(NSProgress * _Nonnull))downloadProgress\n                      success:(void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success\n                      failure:(void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure\n{\n\n    NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@\"GET\"\n                                                        URLString:URLString\n                                                       parameters:parameters\n                                                   uploadProgress:nil\n                                                 downloadProgress:downloadProgress\n                                                          success:success\n                                                          failure:failure];\n\n    [dataTask resume];\n\n    return dataTask;\n}\n\n- (NSURLSessionDataTask *)HEAD:(NSString *)URLString\n                    parameters:(id)parameters\n                       success:(void (^)(NSURLSessionDataTask *task))success\n                       failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure\n{\n    NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@\"HEAD\" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:^(NSURLSessionDataTask *task, __unused id responseObject) {\n        if (success) {\n            success(task);\n        }\n    } failure:failure];\n\n    [dataTask resume];\n\n    return dataTask;\n}\n\n- (NSURLSessionDataTask *)POST:(NSString *)URLString\n                    parameters:(id)parameters\n                       success:(void (^)(NSURLSessionDataTask *task, id responseObject))success\n                       failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure\n{\n    return [self POST:URLString parameters:parameters progress:nil success:success failure:failure];\n}\n\n- (NSURLSessionDataTask *)POST:(NSString *)URLString\n                    parameters:(id)parameters\n                      progress:(void (^)(NSProgress * _Nonnull))uploadProgress\n                       success:(void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success\n                       failure:(void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure\n{\n    NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@\"POST\" URLString:URLString parameters:parameters uploadProgress:uploadProgress downloadProgress:nil success:success failure:failure];\n\n    [dataTask resume];\n\n    return dataTask;\n}\n\n- (NSURLSessionDataTask *)POST:(NSString *)URLString\n                    parameters:(nullable id)parameters\n     constructingBodyWithBlock:(nullable void (^)(id<AFMultipartFormData> _Nonnull))block\n                       success:(nullable void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success\n                       failure:(nullable void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure\n{\n    return [self POST:URLString parameters:parameters constructingBodyWithBlock:block progress:nil success:success failure:failure];\n}\n\n- (NSURLSessionDataTask *)POST:(NSString *)URLString\n                    parameters:(id)parameters\n     constructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData))block\n                      progress:(nullable void (^)(NSProgress * _Nonnull))uploadProgress\n                       success:(void (^)(NSURLSessionDataTask *task, id responseObject))success\n                       failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure\n{\n    NSError *serializationError = nil;\n    NSMutableURLRequest *request = [self.requestSerializer multipartFormRequestWithMethod:@\"POST\" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters constructingBodyWithBlock:block error:&serializationError];\n    if (serializationError) {\n        if (failure) {\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wgnu\"\n            dispatch_async(self.completionQueue ?: dispatch_get_main_queue(), ^{\n                failure(nil, serializationError);\n            });\n#pragma clang diagnostic pop\n        }\n\n        return nil;\n    }\n\n    __block NSURLSessionDataTask *task = [self uploadTaskWithStreamedRequest:request progress:uploadProgress completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) {\n        if (error) {\n            if (failure) {\n                failure(task, error);\n            }\n        } else {\n            if (success) {\n                success(task, responseObject);\n            }\n        }\n    }];\n\n    [task resume];\n\n    return task;\n}\n\n- (NSURLSessionDataTask *)PUT:(NSString *)URLString\n                   parameters:(id)parameters\n                      success:(void (^)(NSURLSessionDataTask *task, id responseObject))success\n                      failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure\n{\n    NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@\"PUT\" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:success failure:failure];\n\n    [dataTask resume];\n\n    return dataTask;\n}\n\n- (NSURLSessionDataTask *)PATCH:(NSString *)URLString\n                     parameters:(id)parameters\n                        success:(void (^)(NSURLSessionDataTask *task, id responseObject))success\n                        failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure\n{\n    NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@\"PATCH\" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:success failure:failure];\n\n    [dataTask resume];\n\n    return dataTask;\n}\n\n- (NSURLSessionDataTask *)DELETE:(NSString *)URLString\n                      parameters:(id)parameters\n                         success:(void (^)(NSURLSessionDataTask *task, id responseObject))success\n                         failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure\n{\n    NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@\"DELETE\" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:success failure:failure];\n\n    [dataTask resume];\n\n    return dataTask;\n}\n\n- (NSURLSessionDataTask *)dataTaskWithHTTPMethod:(NSString *)method\n                                       URLString:(NSString *)URLString\n                                      parameters:(id)parameters\n                                  uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgress\n                                downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgress\n                                         success:(void (^)(NSURLSessionDataTask *, id))success\n                                         failure:(void (^)(NSURLSessionDataTask *, NSError *))failure\n{\n    NSError *serializationError = nil;\n    NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:method URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters error:&serializationError];\n    if (serializationError) {\n        if (failure) {\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wgnu\"\n            dispatch_async(self.completionQueue ?: dispatch_get_main_queue(), ^{\n                failure(nil, serializationError);\n            });\n#pragma clang diagnostic pop\n        }\n\n        return nil;\n    }\n\n    __block NSURLSessionDataTask *dataTask = nil;\n    dataTask = [self dataTaskWithRequest:request\n                          uploadProgress:uploadProgress\n                        downloadProgress:downloadProgress\n                       completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) {\n        if (error) {\n            if (failure) {\n                failure(dataTask, error);\n            }\n        } else {\n            if (success) {\n                success(dataTask, responseObject);\n            }\n        }\n    }];\n\n    return dataTask;\n}\n\n#pragma mark - NSObject\n\n- (NSString *)description {\n    return [NSString stringWithFormat:@\"<%@: %p, baseURL: %@, session: %@, operationQueue: %@>\", NSStringFromClass([self class]), self, [self.baseURL absoluteString], self.session, self.operationQueue];\n}\n\n#pragma mark - NSSecureCoding\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n- (instancetype)initWithCoder:(NSCoder *)decoder {\n    NSURL *baseURL = [decoder decodeObjectOfClass:[NSURL class] forKey:NSStringFromSelector(@selector(baseURL))];\n    NSURLSessionConfiguration *configuration = [decoder decodeObjectOfClass:[NSURLSessionConfiguration class] forKey:@\"sessionConfiguration\"];\n    if (!configuration) {\n        NSString *configurationIdentifier = [decoder decodeObjectOfClass:[NSString class] forKey:@\"identifier\"];\n        if (configurationIdentifier) {\n#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1100)\n            configuration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:configurationIdentifier];\n#else\n            configuration = [NSURLSessionConfiguration backgroundSessionConfiguration:configurationIdentifier];\n#endif\n        }\n    }\n\n    self = [self initWithBaseURL:baseURL sessionConfiguration:configuration];\n    if (!self) {\n        return nil;\n    }\n\n    self.requestSerializer = [decoder decodeObjectOfClass:[AFHTTPRequestSerializer class] forKey:NSStringFromSelector(@selector(requestSerializer))];\n    self.responseSerializer = [decoder decodeObjectOfClass:[AFHTTPResponseSerializer class] forKey:NSStringFromSelector(@selector(responseSerializer))];\n    AFSecurityPolicy *decodedPolicy = [decoder decodeObjectOfClass:[AFSecurityPolicy class] forKey:NSStringFromSelector(@selector(securityPolicy))];\n    if (decodedPolicy) {\n        self.securityPolicy = decodedPolicy;\n    }\n\n    return self;\n}\n\n- (void)encodeWithCoder:(NSCoder *)coder {\n    [super encodeWithCoder:coder];\n\n    [coder encodeObject:self.baseURL forKey:NSStringFromSelector(@selector(baseURL))];\n    if ([self.session.configuration conformsToProtocol:@protocol(NSCoding)]) {\n        [coder encodeObject:self.session.configuration forKey:@\"sessionConfiguration\"];\n    } else {\n        [coder encodeObject:self.session.configuration.identifier forKey:@\"identifier\"];\n    }\n    [coder encodeObject:self.requestSerializer forKey:NSStringFromSelector(@selector(requestSerializer))];\n    [coder encodeObject:self.responseSerializer forKey:NSStringFromSelector(@selector(responseSerializer))];\n    [coder encodeObject:self.securityPolicy forKey:NSStringFromSelector(@selector(securityPolicy))];\n}\n\n#pragma mark - NSCopying\n\n- (instancetype)copyWithZone:(NSZone *)zone {\n    AFHTTPSessionManager *HTTPClient = [[[self class] allocWithZone:zone] initWithBaseURL:self.baseURL sessionConfiguration:self.session.configuration];\n\n    HTTPClient.requestSerializer = [self.requestSerializer copyWithZone:zone];\n    HTTPClient.responseSerializer = [self.responseSerializer copyWithZone:zone];\n    HTTPClient.securityPolicy = [self.securityPolicy copyWithZone:zone];\n    return HTTPClient;\n}\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.h",
    "content": "// AFNetworkReachabilityManager.h\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import <Foundation/Foundation.h>\n\n#if !TARGET_OS_WATCH\n#import <SystemConfiguration/SystemConfiguration.h>\n\ntypedef NS_ENUM(NSInteger, AFNetworkReachabilityStatus) {\n    AFNetworkReachabilityStatusUnknown          = -1,\n    AFNetworkReachabilityStatusNotReachable     = 0,\n    AFNetworkReachabilityStatusReachableViaWWAN = 1,\n    AFNetworkReachabilityStatusReachableViaWiFi = 2,\n};\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n `AFNetworkReachabilityManager` monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces.\n\n Reachability can be used to determine background information about why a network operation failed, or to trigger a network operation retrying when a connection is established. It should not be used to prevent a user from initiating a network request, as it's possible that an initial request may be required to establish reachability.\n\n See Apple's Reachability Sample Code ( https://developer.apple.com/library/ios/samplecode/reachability/ )\n\n @warning Instances of `AFNetworkReachabilityManager` must be started with `-startMonitoring` before reachability status can be determined.\n */\n@interface AFNetworkReachabilityManager : NSObject\n\n/**\n The current network reachability status.\n */\n@property (readonly, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus;\n\n/**\n Whether or not the network is currently reachable.\n */\n@property (readonly, nonatomic, assign, getter = isReachable) BOOL reachable;\n\n/**\n Whether or not the network is currently reachable via WWAN.\n */\n@property (readonly, nonatomic, assign, getter = isReachableViaWWAN) BOOL reachableViaWWAN;\n\n/**\n Whether or not the network is currently reachable via WiFi.\n */\n@property (readonly, nonatomic, assign, getter = isReachableViaWiFi) BOOL reachableViaWiFi;\n\n///---------------------\n/// @name Initialization\n///---------------------\n\n/**\n Returns the shared network reachability manager.\n */\n+ (instancetype)sharedManager;\n\n/**\n Creates and returns a network reachability manager with the default socket address.\n \n @return An initialized network reachability manager, actively monitoring the default socket address.\n */\n+ (instancetype)manager;\n\n/**\n Creates and returns a network reachability manager for the specified domain.\n\n @param domain The domain used to evaluate network reachability.\n\n @return An initialized network reachability manager, actively monitoring the specified domain.\n */\n+ (instancetype)managerForDomain:(NSString *)domain;\n\n/**\n Creates and returns a network reachability manager for the socket address.\n\n @param address The socket address (`sockaddr_in6`) used to evaluate network reachability.\n\n @return An initialized network reachability manager, actively monitoring the specified socket address.\n */\n+ (instancetype)managerForAddress:(const void *)address;\n\n/**\n Initializes an instance of a network reachability manager from the specified reachability object.\n\n @param reachability The reachability object to monitor.\n\n @return An initialized network reachability manager, actively monitoring the specified reachability.\n */\n- (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability NS_DESIGNATED_INITIALIZER;\n\n///--------------------------------------------------\n/// @name Starting & Stopping Reachability Monitoring\n///--------------------------------------------------\n\n/**\n Starts monitoring for changes in network reachability status.\n */\n- (void)startMonitoring;\n\n/**\n Stops monitoring for changes in network reachability status.\n */\n- (void)stopMonitoring;\n\n///-------------------------------------------------\n/// @name Getting Localized Reachability Description\n///-------------------------------------------------\n\n/**\n Returns a localized string representation of the current network reachability status.\n */\n- (NSString *)localizedNetworkReachabilityStatusString;\n\n///---------------------------------------------------\n/// @name Setting Network Reachability Change Callback\n///---------------------------------------------------\n\n/**\n Sets a callback to be executed when the network availability of the `baseURL` host changes.\n\n @param block A block object to be executed when the network availability of the `baseURL` host changes.. This block has no return value and takes a single argument which represents the various reachability states from the device to the `baseURL`.\n */\n- (void)setReachabilityStatusChangeBlock:(nullable void (^)(AFNetworkReachabilityStatus status))block;\n\n@end\n\n///----------------\n/// @name Constants\n///----------------\n\n/**\n ## Network Reachability\n\n The following constants are provided by `AFNetworkReachabilityManager` as possible network reachability statuses.\n\n enum {\n AFNetworkReachabilityStatusUnknown,\n AFNetworkReachabilityStatusNotReachable,\n AFNetworkReachabilityStatusReachableViaWWAN,\n AFNetworkReachabilityStatusReachableViaWiFi,\n }\n\n `AFNetworkReachabilityStatusUnknown`\n The `baseURL` host reachability is not known.\n\n `AFNetworkReachabilityStatusNotReachable`\n The `baseURL` host cannot be reached.\n\n `AFNetworkReachabilityStatusReachableViaWWAN`\n The `baseURL` host can be reached via a cellular connection, such as EDGE or GPRS.\n\n `AFNetworkReachabilityStatusReachableViaWiFi`\n The `baseURL` host can be reached via a Wi-Fi connection.\n\n ### Keys for Notification UserInfo Dictionary\n\n Strings that are used as keys in a `userInfo` dictionary in a network reachability status change notification.\n\n `AFNetworkingReachabilityNotificationStatusItem`\n A key in the userInfo dictionary in a `AFNetworkingReachabilityDidChangeNotification` notification.\n The corresponding value is an `NSNumber` object representing the `AFNetworkReachabilityStatus` value for the current reachability status.\n */\n\n///--------------------\n/// @name Notifications\n///--------------------\n\n/**\n Posted when network reachability changes.\n This notification assigns no notification object. The `userInfo` dictionary contains an `NSNumber` object under the `AFNetworkingReachabilityNotificationStatusItem` key, representing the `AFNetworkReachabilityStatus` value for the current network reachability.\n\n @warning In order for network reachability to be monitored, include the `SystemConfiguration` framework in the active target's \"Link Binary With Library\" build phase, and add `#import <SystemConfiguration/SystemConfiguration.h>` to the header prefix of the project (`Prefix.pch`).\n */\nFOUNDATION_EXPORT NSString * const AFNetworkingReachabilityDidChangeNotification;\nFOUNDATION_EXPORT NSString * const AFNetworkingReachabilityNotificationStatusItem;\n\n///--------------------\n/// @name Functions\n///--------------------\n\n/**\n Returns a localized string representation of an `AFNetworkReachabilityStatus` value.\n */\nFOUNDATION_EXPORT NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status);\n\nNS_ASSUME_NONNULL_END\n#endif\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.m",
    "content": "// AFNetworkReachabilityManager.m\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import \"AFNetworkReachabilityManager.h\"\n#if !TARGET_OS_WATCH\n\n#import <netinet/in.h>\n#import <netinet6/in6.h>\n#import <arpa/inet.h>\n#import <ifaddrs.h>\n#import <netdb.h>\n\nNSString * const AFNetworkingReachabilityDidChangeNotification = @\"com.alamofire.networking.reachability.change\";\nNSString * const AFNetworkingReachabilityNotificationStatusItem = @\"AFNetworkingReachabilityNotificationStatusItem\";\n\ntypedef void (^AFNetworkReachabilityStatusBlock)(AFNetworkReachabilityStatus status);\n\nNSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status) {\n    switch (status) {\n        case AFNetworkReachabilityStatusNotReachable:\n            return NSLocalizedStringFromTable(@\"Not Reachable\", @\"AFNetworking\", nil);\n        case AFNetworkReachabilityStatusReachableViaWWAN:\n            return NSLocalizedStringFromTable(@\"Reachable via WWAN\", @\"AFNetworking\", nil);\n        case AFNetworkReachabilityStatusReachableViaWiFi:\n            return NSLocalizedStringFromTable(@\"Reachable via WiFi\", @\"AFNetworking\", nil);\n        case AFNetworkReachabilityStatusUnknown:\n        default:\n            return NSLocalizedStringFromTable(@\"Unknown\", @\"AFNetworking\", nil);\n    }\n}\n\nstatic AFNetworkReachabilityStatus AFNetworkReachabilityStatusForFlags(SCNetworkReachabilityFlags flags) {\n    BOOL isReachable = ((flags & kSCNetworkReachabilityFlagsReachable) != 0);\n    BOOL needsConnection = ((flags & kSCNetworkReachabilityFlagsConnectionRequired) != 0);\n    BOOL canConnectionAutomatically = (((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) || ((flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0));\n    BOOL canConnectWithoutUserInteraction = (canConnectionAutomatically && (flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0);\n    BOOL isNetworkReachable = (isReachable && (!needsConnection || canConnectWithoutUserInteraction));\n\n    AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusUnknown;\n    if (isNetworkReachable == NO) {\n        status = AFNetworkReachabilityStatusNotReachable;\n    }\n#if\tTARGET_OS_IPHONE\n    else if ((flags & kSCNetworkReachabilityFlagsIsWWAN) != 0) {\n        status = AFNetworkReachabilityStatusReachableViaWWAN;\n    }\n#endif\n    else {\n        status = AFNetworkReachabilityStatusReachableViaWiFi;\n    }\n\n    return status;\n}\n\n/**\n * Queue a status change notification for the main thread.\n *\n * This is done to ensure that the notifications are received in the same order\n * as they are sent. If notifications are sent directly, it is possible that\n * a queued notification (for an earlier status condition) is processed after\n * the later update, resulting in the listener being left in the wrong state.\n */\nstatic void AFPostReachabilityStatusChange(SCNetworkReachabilityFlags flags, AFNetworkReachabilityStatusBlock block) {\n    AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusForFlags(flags);\n    dispatch_async(dispatch_get_main_queue(), ^{\n        if (block) {\n            block(status);\n        }\n        NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];\n        NSDictionary *userInfo = @{ AFNetworkingReachabilityNotificationStatusItem: @(status) };\n        [notificationCenter postNotificationName:AFNetworkingReachabilityDidChangeNotification object:nil userInfo:userInfo];\n    });\n}\n\nstatic void AFNetworkReachabilityCallback(SCNetworkReachabilityRef __unused target, SCNetworkReachabilityFlags flags, void *info) {\n    AFPostReachabilityStatusChange(flags, (__bridge AFNetworkReachabilityStatusBlock)info);\n}\n\n\nstatic const void * AFNetworkReachabilityRetainCallback(const void *info) {\n    return Block_copy(info);\n}\n\nstatic void AFNetworkReachabilityReleaseCallback(const void *info) {\n    if (info) {\n        Block_release(info);\n    }\n}\n\n@interface AFNetworkReachabilityManager ()\n@property (readonly, nonatomic, assign) SCNetworkReachabilityRef networkReachability;\n@property (readwrite, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus;\n@property (readwrite, nonatomic, copy) AFNetworkReachabilityStatusBlock networkReachabilityStatusBlock;\n@end\n\n@implementation AFNetworkReachabilityManager\n\n+ (instancetype)sharedManager {\n    static AFNetworkReachabilityManager *_sharedManager = nil;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        _sharedManager = [self manager];\n    });\n\n    return _sharedManager;\n}\n\n+ (instancetype)managerForDomain:(NSString *)domain {\n    SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, [domain UTF8String]);\n\n    AFNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability];\n    \n    CFRelease(reachability);\n\n    return manager;\n}\n\n+ (instancetype)managerForAddress:(const void *)address {\n    SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr *)address);\n    AFNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability];\n\n    CFRelease(reachability);\n    \n    return manager;\n}\n\n+ (instancetype)manager\n{\n#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)\n    struct sockaddr_in6 address;\n    bzero(&address, sizeof(address));\n    address.sin6_len = sizeof(address);\n    address.sin6_family = AF_INET6;\n#else\n    struct sockaddr_in address;\n    bzero(&address, sizeof(address));\n    address.sin_len = sizeof(address);\n    address.sin_family = AF_INET;\n#endif\n    return [self managerForAddress:&address];\n}\n\n- (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability {\n    self = [super init];\n    if (!self) {\n        return nil;\n    }\n\n    _networkReachability = CFRetain(reachability);\n    self.networkReachabilityStatus = AFNetworkReachabilityStatusUnknown;\n\n    return self;\n}\n\n- (instancetype)init NS_UNAVAILABLE\n{\n    return nil;\n}\n\n- (void)dealloc {\n    [self stopMonitoring];\n    \n    if (_networkReachability != NULL) {\n        CFRelease(_networkReachability);\n    }\n}\n\n#pragma mark -\n\n- (BOOL)isReachable {\n    return [self isReachableViaWWAN] || [self isReachableViaWiFi];\n}\n\n- (BOOL)isReachableViaWWAN {\n    return self.networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWWAN;\n}\n\n- (BOOL)isReachableViaWiFi {\n    return self.networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWiFi;\n}\n\n#pragma mark -\n\n- (void)startMonitoring {\n    [self stopMonitoring];\n\n    if (!self.networkReachability) {\n        return;\n    }\n\n    __weak __typeof(self)weakSelf = self;\n    AFNetworkReachabilityStatusBlock callback = ^(AFNetworkReachabilityStatus status) {\n        __strong __typeof(weakSelf)strongSelf = weakSelf;\n\n        strongSelf.networkReachabilityStatus = status;\n        if (strongSelf.networkReachabilityStatusBlock) {\n            strongSelf.networkReachabilityStatusBlock(status);\n        }\n\n    };\n\n    SCNetworkReachabilityContext context = {0, (__bridge void *)callback, AFNetworkReachabilityRetainCallback, AFNetworkReachabilityReleaseCallback, NULL};\n    SCNetworkReachabilitySetCallback(self.networkReachability, AFNetworkReachabilityCallback, &context);\n    SCNetworkReachabilityScheduleWithRunLoop(self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes);\n\n    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0),^{\n        SCNetworkReachabilityFlags flags;\n        if (SCNetworkReachabilityGetFlags(self.networkReachability, &flags)) {\n            AFPostReachabilityStatusChange(flags, callback);\n        }\n    });\n}\n\n- (void)stopMonitoring {\n    if (!self.networkReachability) {\n        return;\n    }\n\n    SCNetworkReachabilityUnscheduleFromRunLoop(self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes);\n}\n\n#pragma mark -\n\n- (NSString *)localizedNetworkReachabilityStatusString {\n    return AFStringFromNetworkReachabilityStatus(self.networkReachabilityStatus);\n}\n\n#pragma mark -\n\n- (void)setReachabilityStatusChangeBlock:(void (^)(AFNetworkReachabilityStatus status))block {\n    self.networkReachabilityStatusBlock = block;\n}\n\n#pragma mark - NSKeyValueObserving\n\n+ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key {\n    if ([key isEqualToString:@\"reachable\"] || [key isEqualToString:@\"reachableViaWWAN\"] || [key isEqualToString:@\"reachableViaWiFi\"]) {\n        return [NSSet setWithObject:@\"networkReachabilityStatus\"];\n    }\n\n    return [super keyPathsForValuesAffectingValueForKey:key];\n}\n\n@end\n#endif\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/AFNetworking/AFNetworking.h",
    "content": "// AFNetworking.h\n//\n// Copyright (c) 2013 AFNetworking (http://afnetworking.com/)\n// \n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n// \n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n// \n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import <Foundation/Foundation.h>\n#import <Availability.h>\n#import <TargetConditionals.h>\n\n#ifndef _AFNETWORKING_\n    #define _AFNETWORKING_\n\n    #import \"AFURLRequestSerialization.h\"\n    #import \"AFURLResponseSerialization.h\"\n    #import \"AFSecurityPolicy.h\"\n\n#if !TARGET_OS_WATCH\n    #import \"AFNetworkReachabilityManager.h\"\n#endif\n\n    #import \"AFURLSessionManager.h\"\n    #import \"AFHTTPSessionManager.h\"\n\n#endif /* _AFNETWORKING_ */\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/AFNetworking/AFSecurityPolicy.h",
    "content": "// AFSecurityPolicy.h\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import <Foundation/Foundation.h>\n#import <Security/Security.h>\n\ntypedef NS_ENUM(NSUInteger, AFSSLPinningMode) {\n    AFSSLPinningModeNone,\n    AFSSLPinningModePublicKey,\n    AFSSLPinningModeCertificate,\n};\n\n/**\n `AFSecurityPolicy` evaluates server trust against pinned X.509 certificates and public keys over secure connections.\n\n Adding pinned SSL certificates to your app helps prevent man-in-the-middle attacks and other vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged to route all communication over an HTTPS connection with SSL pinning configured and enabled.\n */\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface AFSecurityPolicy : NSObject <NSSecureCoding, NSCopying>\n\n/**\n The criteria by which server trust should be evaluated against the pinned SSL certificates. Defaults to `AFSSLPinningModeNone`.\n */\n@property (readonly, nonatomic, assign) AFSSLPinningMode SSLPinningMode;\n\n/**\n The certificates used to evaluate server trust according to the SSL pinning mode. \n\n  By default, this property is set to any (`.cer`) certificates included in the target compiling AFNetworking. Note that if you are using AFNetworking as embedded framework, no certificates will be pinned by default. Use `certificatesInBundle` to load certificates from your target, and then create a new policy by calling `policyWithPinningMode:withPinnedCertificates`.\n \n Note that if pinning is enabled, `evaluateServerTrust:forDomain:` will return true if any pinned certificate matches.\n */\n@property (nonatomic, strong, nullable) NSSet <NSData *> *pinnedCertificates;\n\n/**\n Whether or not to trust servers with an invalid or expired SSL certificates. Defaults to `NO`.\n */\n@property (nonatomic, assign) BOOL allowInvalidCertificates;\n\n/**\n Whether or not to validate the domain name in the certificate's CN field. Defaults to `YES`.\n */\n@property (nonatomic, assign) BOOL validatesDomainName;\n\n///-----------------------------------------\n/// @name Getting Certificates from the Bundle\n///-----------------------------------------\n\n/**\n Returns any certificates included in the bundle. If you are using AFNetworking as an embedded framework, you must use this method to find the certificates you have included in your app bundle, and use them when creating your security policy by calling `policyWithPinningMode:withPinnedCertificates`.\n\n @return The certificates included in the given bundle.\n */\n+ (NSSet <NSData *> *)certificatesInBundle:(NSBundle *)bundle;\n\n///-----------------------------------------\n/// @name Getting Specific Security Policies\n///-----------------------------------------\n\n/**\n Returns the shared default security policy, which does not allow invalid certificates, validates domain name, and does not validate against pinned certificates or public keys.\n\n @return The default security policy.\n */\n+ (instancetype)defaultPolicy;\n\n///---------------------\n/// @name Initialization\n///---------------------\n\n/**\n Creates and returns a security policy with the specified pinning mode.\n\n @param pinningMode The SSL pinning mode.\n\n @return A new security policy.\n */\n+ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode;\n\n/**\n Creates and returns a security policy with the specified pinning mode.\n\n @param pinningMode The SSL pinning mode.\n @param pinnedCertificates The certificates to pin against.\n\n @return A new security policy.\n */\n+ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode withPinnedCertificates:(NSSet <NSData *> *)pinnedCertificates;\n\n///------------------------------\n/// @name Evaluating Server Trust\n///------------------------------\n\n/**\n Whether or not the specified server trust should be accepted, based on the security policy.\n\n This method should be used when responding to an authentication challenge from a server.\n\n @param serverTrust The X.509 certificate trust of the server.\n @param domain The domain of serverTrust. If `nil`, the domain will not be validated.\n\n @return Whether or not to trust the server.\n */\n- (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust\n                  forDomain:(nullable NSString *)domain;\n\n@end\n\nNS_ASSUME_NONNULL_END\n\n///----------------\n/// @name Constants\n///----------------\n\n/**\n ## SSL Pinning Modes\n\n The following constants are provided by `AFSSLPinningMode` as possible SSL pinning modes.\n\n enum {\n AFSSLPinningModeNone,\n AFSSLPinningModePublicKey,\n AFSSLPinningModeCertificate,\n }\n\n `AFSSLPinningModeNone`\n Do not used pinned certificates to validate servers.\n\n `AFSSLPinningModePublicKey`\n Validate host certificates against public keys of pinned certificates.\n\n `AFSSLPinningModeCertificate`\n Validate host certificates against pinned certificates.\n*/\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/AFNetworking/AFSecurityPolicy.m",
    "content": "// AFSecurityPolicy.m\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import \"AFSecurityPolicy.h\"\n\n#import <AssertMacros.h>\n\n#if !TARGET_OS_IOS && !TARGET_OS_WATCH && !TARGET_OS_TV\nstatic NSData * AFSecKeyGetData(SecKeyRef key) {\n    CFDataRef data = NULL;\n\n    __Require_noErr_Quiet(SecItemExport(key, kSecFormatUnknown, kSecItemPemArmour, NULL, &data), _out);\n\n    return (__bridge_transfer NSData *)data;\n\n_out:\n    if (data) {\n        CFRelease(data);\n    }\n\n    return nil;\n}\n#endif\n\nstatic BOOL AFSecKeyIsEqualToKey(SecKeyRef key1, SecKeyRef key2) {\n#if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV\n    return [(__bridge id)key1 isEqual:(__bridge id)key2];\n#else\n    return [AFSecKeyGetData(key1) isEqual:AFSecKeyGetData(key2)];\n#endif\n}\n\nstatic id AFPublicKeyForCertificate(NSData *certificate) {\n    id allowedPublicKey = nil;\n    SecCertificateRef allowedCertificate;\n    SecCertificateRef allowedCertificates[1];\n    CFArrayRef tempCertificates = nil;\n    SecPolicyRef policy = nil;\n    SecTrustRef allowedTrust = nil;\n    SecTrustResultType result;\n\n    allowedCertificate = SecCertificateCreateWithData(NULL, (__bridge CFDataRef)certificate);\n    __Require_Quiet(allowedCertificate != NULL, _out);\n\n    allowedCertificates[0] = allowedCertificate;\n    tempCertificates = CFArrayCreate(NULL, (const void **)allowedCertificates, 1, NULL);\n\n    policy = SecPolicyCreateBasicX509();\n    __Require_noErr_Quiet(SecTrustCreateWithCertificates(tempCertificates, policy, &allowedTrust), _out);\n    __Require_noErr_Quiet(SecTrustEvaluate(allowedTrust, &result), _out);\n\n    allowedPublicKey = (__bridge_transfer id)SecTrustCopyPublicKey(allowedTrust);\n\n_out:\n    if (allowedTrust) {\n        CFRelease(allowedTrust);\n    }\n\n    if (policy) {\n        CFRelease(policy);\n    }\n\n    if (tempCertificates) {\n        CFRelease(tempCertificates);\n    }\n\n    if (allowedCertificate) {\n        CFRelease(allowedCertificate);\n    }\n\n    return allowedPublicKey;\n}\n\nstatic BOOL AFServerTrustIsValid(SecTrustRef serverTrust) {\n    BOOL isValid = NO;\n    SecTrustResultType result;\n    __Require_noErr_Quiet(SecTrustEvaluate(serverTrust, &result), _out);\n\n    isValid = (result == kSecTrustResultUnspecified || result == kSecTrustResultProceed);\n\n_out:\n    return isValid;\n}\n\nstatic NSArray * AFCertificateTrustChainForServerTrust(SecTrustRef serverTrust) {\n    CFIndex certificateCount = SecTrustGetCertificateCount(serverTrust);\n    NSMutableArray *trustChain = [NSMutableArray arrayWithCapacity:(NSUInteger)certificateCount];\n\n    for (CFIndex i = 0; i < certificateCount; i++) {\n        SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, i);\n        [trustChain addObject:(__bridge_transfer NSData *)SecCertificateCopyData(certificate)];\n    }\n\n    return [NSArray arrayWithArray:trustChain];\n}\n\nstatic NSArray * AFPublicKeyTrustChainForServerTrust(SecTrustRef serverTrust) {\n    SecPolicyRef policy = SecPolicyCreateBasicX509();\n    CFIndex certificateCount = SecTrustGetCertificateCount(serverTrust);\n    NSMutableArray *trustChain = [NSMutableArray arrayWithCapacity:(NSUInteger)certificateCount];\n    for (CFIndex i = 0; i < certificateCount; i++) {\n        SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, i);\n\n        SecCertificateRef someCertificates[] = {certificate};\n        CFArrayRef certificates = CFArrayCreate(NULL, (const void **)someCertificates, 1, NULL);\n\n        SecTrustRef trust;\n        __Require_noErr_Quiet(SecTrustCreateWithCertificates(certificates, policy, &trust), _out);\n\n        SecTrustResultType result;\n        __Require_noErr_Quiet(SecTrustEvaluate(trust, &result), _out);\n\n        [trustChain addObject:(__bridge_transfer id)SecTrustCopyPublicKey(trust)];\n\n    _out:\n        if (trust) {\n            CFRelease(trust);\n        }\n\n        if (certificates) {\n            CFRelease(certificates);\n        }\n\n        continue;\n    }\n    CFRelease(policy);\n\n    return [NSArray arrayWithArray:trustChain];\n}\n\n#pragma mark -\n\n@interface AFSecurityPolicy()\n@property (readwrite, nonatomic, assign) AFSSLPinningMode SSLPinningMode;\n@property (readwrite, nonatomic, strong) NSSet *pinnedPublicKeys;\n@end\n\n@implementation AFSecurityPolicy\n\n+ (NSSet *)certificatesInBundle:(NSBundle *)bundle {\n    NSArray *paths = [bundle pathsForResourcesOfType:@\"cer\" inDirectory:@\".\"];\n\n    NSMutableSet *certificates = [NSMutableSet setWithCapacity:[paths count]];\n    for (NSString *path in paths) {\n        NSData *certificateData = [NSData dataWithContentsOfFile:path];\n        [certificates addObject:certificateData];\n    }\n\n    return [NSSet setWithSet:certificates];\n}\n\n+ (NSSet *)defaultPinnedCertificates {\n    static NSSet *_defaultPinnedCertificates = nil;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        NSBundle *bundle = [NSBundle bundleForClass:[self class]];\n        _defaultPinnedCertificates = [self certificatesInBundle:bundle];\n    });\n\n    return _defaultPinnedCertificates;\n}\n\n+ (instancetype)defaultPolicy {\n    AFSecurityPolicy *securityPolicy = [[self alloc] init];\n    securityPolicy.SSLPinningMode = AFSSLPinningModeNone;\n\n    return securityPolicy;\n}\n\n+ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode {\n    return [self policyWithPinningMode:pinningMode withPinnedCertificates:[self defaultPinnedCertificates]];\n}\n\n+ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode withPinnedCertificates:(NSSet *)pinnedCertificates {\n    AFSecurityPolicy *securityPolicy = [[self alloc] init];\n    securityPolicy.SSLPinningMode = pinningMode;\n\n    [securityPolicy setPinnedCertificates:pinnedCertificates];\n\n    return securityPolicy;\n}\n\n- (instancetype)init {\n    self = [super init];\n    if (!self) {\n        return nil;\n    }\n\n    self.validatesDomainName = YES;\n\n    return self;\n}\n\n- (void)setPinnedCertificates:(NSSet *)pinnedCertificates {\n    _pinnedCertificates = pinnedCertificates;\n\n    if (self.pinnedCertificates) {\n        NSMutableSet *mutablePinnedPublicKeys = [NSMutableSet setWithCapacity:[self.pinnedCertificates count]];\n        for (NSData *certificate in self.pinnedCertificates) {\n            id publicKey = AFPublicKeyForCertificate(certificate);\n            if (!publicKey) {\n                continue;\n            }\n            [mutablePinnedPublicKeys addObject:publicKey];\n        }\n        self.pinnedPublicKeys = [NSSet setWithSet:mutablePinnedPublicKeys];\n    } else {\n        self.pinnedPublicKeys = nil;\n    }\n}\n\n#pragma mark -\n\n- (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust\n                  forDomain:(NSString *)domain\n{\n    if (domain && self.allowInvalidCertificates && self.validatesDomainName && (self.SSLPinningMode == AFSSLPinningModeNone || [self.pinnedCertificates count] == 0)) {\n        // https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/NetworkingTopics/Articles/OverridingSSLChainValidationCorrectly.html\n        //  According to the docs, you should only trust your provided certs for evaluation.\n        //  Pinned certificates are added to the trust. Without pinned certificates,\n        //  there is nothing to evaluate against.\n        //\n        //  From Apple Docs:\n        //          \"Do not implicitly trust self-signed certificates as anchors (kSecTrustOptionImplicitAnchors).\n        //           Instead, add your own (self-signed) CA certificate to the list of trusted anchors.\"\n        NSLog(@\"In order to validate a domain name for self signed certificates, you MUST use pinning.\");\n        return NO;\n    }\n\n    NSMutableArray *policies = [NSMutableArray array];\n    if (self.validatesDomainName) {\n        [policies addObject:(__bridge_transfer id)SecPolicyCreateSSL(true, (__bridge CFStringRef)domain)];\n    } else {\n        [policies addObject:(__bridge_transfer id)SecPolicyCreateBasicX509()];\n    }\n\n    SecTrustSetPolicies(serverTrust, (__bridge CFArrayRef)policies);\n\n    if (self.SSLPinningMode == AFSSLPinningModeNone) {\n        return self.allowInvalidCertificates || AFServerTrustIsValid(serverTrust);\n    } else if (!AFServerTrustIsValid(serverTrust) && !self.allowInvalidCertificates) {\n        return NO;\n    }\n\n    switch (self.SSLPinningMode) {\n        case AFSSLPinningModeNone:\n        default:\n            return NO;\n        case AFSSLPinningModeCertificate: {\n            NSMutableArray *pinnedCertificates = [NSMutableArray array];\n            for (NSData *certificateData in self.pinnedCertificates) {\n                [pinnedCertificates addObject:(__bridge_transfer id)SecCertificateCreateWithData(NULL, (__bridge CFDataRef)certificateData)];\n            }\n            SecTrustSetAnchorCertificates(serverTrust, (__bridge CFArrayRef)pinnedCertificates);\n\n            if (!AFServerTrustIsValid(serverTrust)) {\n                return NO;\n            }\n\n            // obtain the chain after being validated, which *should* contain the pinned certificate in the last position (if it's the Root CA)\n            NSArray *serverCertificates = AFCertificateTrustChainForServerTrust(serverTrust);\n            \n            for (NSData *trustChainCertificate in [serverCertificates reverseObjectEnumerator]) {\n                if ([self.pinnedCertificates containsObject:trustChainCertificate]) {\n                    return YES;\n                }\n            }\n            \n            return NO;\n        }\n        case AFSSLPinningModePublicKey: {\n            NSUInteger trustedPublicKeyCount = 0;\n            NSArray *publicKeys = AFPublicKeyTrustChainForServerTrust(serverTrust);\n\n            for (id trustChainPublicKey in publicKeys) {\n                for (id pinnedPublicKey in self.pinnedPublicKeys) {\n                    if (AFSecKeyIsEqualToKey((__bridge SecKeyRef)trustChainPublicKey, (__bridge SecKeyRef)pinnedPublicKey)) {\n                        trustedPublicKeyCount += 1;\n                    }\n                }\n            }\n            return trustedPublicKeyCount > 0;\n        }\n    }\n    \n    return NO;\n}\n\n#pragma mark - NSKeyValueObserving\n\n+ (NSSet *)keyPathsForValuesAffectingPinnedPublicKeys {\n    return [NSSet setWithObject:@\"pinnedCertificates\"];\n}\n\n#pragma mark - NSSecureCoding\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n- (instancetype)initWithCoder:(NSCoder *)decoder {\n\n    self = [self init];\n    if (!self) {\n        return nil;\n    }\n\n    self.SSLPinningMode = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(SSLPinningMode))] unsignedIntegerValue];\n    self.allowInvalidCertificates = [decoder decodeBoolForKey:NSStringFromSelector(@selector(allowInvalidCertificates))];\n    self.validatesDomainName = [decoder decodeBoolForKey:NSStringFromSelector(@selector(validatesDomainName))];\n    self.pinnedCertificates = [decoder decodeObjectOfClass:[NSArray class] forKey:NSStringFromSelector(@selector(pinnedCertificates))];\n\n    return self;\n}\n\n- (void)encodeWithCoder:(NSCoder *)coder {\n    [coder encodeObject:[NSNumber numberWithUnsignedInteger:self.SSLPinningMode] forKey:NSStringFromSelector(@selector(SSLPinningMode))];\n    [coder encodeBool:self.allowInvalidCertificates forKey:NSStringFromSelector(@selector(allowInvalidCertificates))];\n    [coder encodeBool:self.validatesDomainName forKey:NSStringFromSelector(@selector(validatesDomainName))];\n    [coder encodeObject:self.pinnedCertificates forKey:NSStringFromSelector(@selector(pinnedCertificates))];\n}\n\n#pragma mark - NSCopying\n\n- (instancetype)copyWithZone:(NSZone *)zone {\n    AFSecurityPolicy *securityPolicy = [[[self class] allocWithZone:zone] init];\n    securityPolicy.SSLPinningMode = self.SSLPinningMode;\n    securityPolicy.allowInvalidCertificates = self.allowInvalidCertificates;\n    securityPolicy.validatesDomainName = self.validatesDomainName;\n    securityPolicy.pinnedCertificates = [self.pinnedCertificates copyWithZone:zone];\n\n    return securityPolicy;\n}\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/AFNetworking/AFURLRequestSerialization.h",
    "content": "// AFURLRequestSerialization.h\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import <Foundation/Foundation.h>\n#import <TargetConditionals.h>\n\n#if TARGET_OS_IOS || TARGET_OS_TV\n#import <UIKit/UIKit.h>\n#elif TARGET_OS_WATCH\n#import <WatchKit/WatchKit.h>\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n Returns a percent-escaped string following RFC 3986 for a query string key or value.\n RFC 3986 states that the following characters are \"reserved\" characters.\n - General Delimiters: \":\", \"#\", \"[\", \"]\", \"@\", \"?\", \"/\"\n - Sub-Delimiters: \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\"\n\n In RFC 3986 - Section 3.4, it states that the \"?\" and \"/\" characters should not be escaped to allow\n query strings to include a URL. Therefore, all \"reserved\" characters with the exception of \"?\" and \"/\"\n should be percent-escaped in the query string.\n \n @param string The string to be percent-escaped.\n \n @return The percent-escaped string.\n */\nFOUNDATION_EXPORT NSString * AFPercentEscapedStringFromString(NSString *string);\n\n/**\n A helper method to generate encoded url query parameters for appending to the end of a URL.\n\n @param parameters A dictionary of key/values to be encoded.\n\n @return A url encoded query string\n */\nFOUNDATION_EXPORT NSString * AFQueryStringFromParameters(NSDictionary *parameters);\n\n/**\n The `AFURLRequestSerialization` protocol is adopted by an object that encodes parameters for a specified HTTP requests. Request serializers may encode parameters as query strings, HTTP bodies, setting the appropriate HTTP header fields as necessary.\n\n For example, a JSON request serializer may set the HTTP body of the request to a JSON representation, and set the `Content-Type` HTTP header field value to `application/json`.\n */\n@protocol AFURLRequestSerialization <NSObject, NSSecureCoding, NSCopying>\n\n/**\n Returns a request with the specified parameters encoded into a copy of the original request.\n\n @param request The original request.\n @param parameters The parameters to be encoded.\n @param error The error that occurred while attempting to encode the request parameters.\n\n @return A serialized request.\n */\n- (nullable NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request\n                               withParameters:(nullable id)parameters\n                                        error:(NSError * _Nullable __autoreleasing *)error NS_SWIFT_NOTHROW;\n\n@end\n\n#pragma mark -\n\n/**\n\n */\ntypedef NS_ENUM(NSUInteger, AFHTTPRequestQueryStringSerializationStyle) {\n    AFHTTPRequestQueryStringDefaultStyle = 0,\n};\n\n@protocol AFMultipartFormData;\n\n/**\n `AFHTTPRequestSerializer` conforms to the `AFURLRequestSerialization` & `AFURLResponseSerialization` protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation.\n\n Any request or response serializer dealing with HTTP is encouraged to subclass `AFHTTPRequestSerializer` in order to ensure consistent default behavior.\n */\n@interface AFHTTPRequestSerializer : NSObject <AFURLRequestSerialization>\n\n/**\n The string encoding used to serialize parameters. `NSUTF8StringEncoding` by default.\n */\n@property (nonatomic, assign) NSStringEncoding stringEncoding;\n\n/**\n Whether created requests can use the device’s cellular radio (if present). `YES` by default.\n\n @see NSMutableURLRequest -setAllowsCellularAccess:\n */\n@property (nonatomic, assign) BOOL allowsCellularAccess;\n\n/**\n The cache policy of created requests. `NSURLRequestUseProtocolCachePolicy` by default.\n\n @see NSMutableURLRequest -setCachePolicy:\n */\n@property (nonatomic, assign) NSURLRequestCachePolicy cachePolicy;\n\n/**\n Whether created requests should use the default cookie handling. `YES` by default.\n\n @see NSMutableURLRequest -setHTTPShouldHandleCookies:\n */\n@property (nonatomic, assign) BOOL HTTPShouldHandleCookies;\n\n/**\n Whether created requests can continue transmitting data before receiving a response from an earlier transmission. `NO` by default\n\n @see NSMutableURLRequest -setHTTPShouldUsePipelining:\n */\n@property (nonatomic, assign) BOOL HTTPShouldUsePipelining;\n\n/**\n The network service type for created requests. `NSURLNetworkServiceTypeDefault` by default.\n\n @see NSMutableURLRequest -setNetworkServiceType:\n */\n@property (nonatomic, assign) NSURLRequestNetworkServiceType networkServiceType;\n\n/**\n The timeout interval, in seconds, for created requests. The default timeout interval is 60 seconds.\n\n @see NSMutableURLRequest -setTimeoutInterval:\n */\n@property (nonatomic, assign) NSTimeInterval timeoutInterval;\n\n///---------------------------------------\n/// @name Configuring HTTP Request Headers\n///---------------------------------------\n\n/**\n Default HTTP header field values to be applied to serialized requests. By default, these include the following:\n\n - `Accept-Language` with the contents of `NSLocale +preferredLanguages`\n - `User-Agent` with the contents of various bundle identifiers and OS designations\n\n @discussion To add or remove default request headers, use `setValue:forHTTPHeaderField:`.\n */\n@property (readonly, nonatomic, strong) NSDictionary <NSString *, NSString *> *HTTPRequestHeaders;\n\n/**\n Creates and returns a serializer with default configuration.\n */\n+ (instancetype)serializer;\n\n/**\n Sets the value for the HTTP headers set in request objects made by the HTTP client. If `nil`, removes the existing value for that header.\n\n @param field The HTTP header to set a default value for\n @param value The value set as default for the specified header, or `nil`\n */\n- (void)setValue:(nullable NSString *)value\nforHTTPHeaderField:(NSString *)field;\n\n/**\n Returns the value for the HTTP headers set in the request serializer.\n\n @param field The HTTP header to retrieve the default value for\n\n @return The value set as default for the specified header, or `nil`\n */\n- (nullable NSString *)valueForHTTPHeaderField:(NSString *)field;\n\n/**\n Sets the \"Authorization\" HTTP header set in request objects made by the HTTP client to a basic authentication value with Base64-encoded username and password. This overwrites any existing value for this header.\n\n @param username The HTTP basic auth username\n @param password The HTTP basic auth password\n */\n- (void)setAuthorizationHeaderFieldWithUsername:(NSString *)username\n                                       password:(NSString *)password;\n\n/**\n Clears any existing value for the \"Authorization\" HTTP header.\n */\n- (void)clearAuthorizationHeader;\n\n///-------------------------------------------------------\n/// @name Configuring Query String Parameter Serialization\n///-------------------------------------------------------\n\n/**\n HTTP methods for which serialized requests will encode parameters as a query string. `GET`, `HEAD`, and `DELETE` by default.\n */\n@property (nonatomic, strong) NSSet <NSString *> *HTTPMethodsEncodingParametersInURI;\n\n/**\n Set the method of query string serialization according to one of the pre-defined styles.\n\n @param style The serialization style.\n\n @see AFHTTPRequestQueryStringSerializationStyle\n */\n- (void)setQueryStringSerializationWithStyle:(AFHTTPRequestQueryStringSerializationStyle)style;\n\n/**\n Set the a custom method of query string serialization according to the specified block.\n\n @param block A block that defines a process of encoding parameters into a query string. This block returns the query string and takes three arguments: the request, the parameters to encode, and the error that occurred when attempting to encode parameters for the given request.\n */\n- (void)setQueryStringSerializationWithBlock:(nullable NSString * (^)(NSURLRequest *request, id parameters, NSError * __autoreleasing *error))block;\n\n///-------------------------------\n/// @name Creating Request Objects\n///-------------------------------\n\n/**\n Creates an `NSMutableURLRequest` object with the specified HTTP method and URL string.\n\n If the HTTP method is `GET`, `HEAD`, or `DELETE`, the parameters will be used to construct a url-encoded query string that is appended to the request's URL. Otherwise, the parameters will be encoded according to the value of the `parameterEncoding` property, and set as the request body.\n\n @param method The HTTP method for the request, such as `GET`, `POST`, `PUT`, or `DELETE`. This parameter must not be `nil`.\n @param URLString The URL string used to create the request URL.\n @param parameters The parameters to be either set as a query string for `GET` requests, or the request HTTP body.\n @param error The error that occurred while constructing the request.\n\n @return An `NSMutableURLRequest` object.\n */\n- (NSMutableURLRequest *)requestWithMethod:(NSString *)method\n                                 URLString:(NSString *)URLString\n                                parameters:(nullable id)parameters\n                                     error:(NSError * _Nullable __autoreleasing *)error;\n\n/**\n Creates an `NSMutableURLRequest` object with the specified HTTP method and URLString, and constructs a `multipart/form-data` HTTP body, using the specified parameters and multipart form data block. See http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.2\n\n Multipart form requests are automatically streamed, reading files directly from disk along with in-memory data in a single HTTP body. The resulting `NSMutableURLRequest` object has an `HTTPBodyStream` property, so refrain from setting `HTTPBodyStream` or `HTTPBody` on this request object, as it will clear out the multipart form body stream.\n\n @param method The HTTP method for the request. This parameter must not be `GET` or `HEAD`, or `nil`.\n @param URLString The URL string used to create the request URL.\n @param parameters The parameters to be encoded and set in the request HTTP body.\n @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol.\n @param error The error that occurred while constructing the request.\n\n @return An `NSMutableURLRequest` object\n */\n- (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)method\n                                              URLString:(NSString *)URLString\n                                             parameters:(nullable NSDictionary <NSString *, id> *)parameters\n                              constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block\n                                                  error:(NSError * _Nullable __autoreleasing *)error;\n\n/**\n Creates an `NSMutableURLRequest` by removing the `HTTPBodyStream` from a request, and asynchronously writing its contents into the specified file, invoking the completion handler when finished.\n\n @param request The multipart form request. The `HTTPBodyStream` property of `request` must not be `nil`.\n @param fileURL The file URL to write multipart form contents to.\n @param handler A handler block to execute.\n\n @discussion There is a bug in `NSURLSessionTask` that causes requests to not send a `Content-Length` header when streaming contents from an HTTP body, which is notably problematic when interacting with the Amazon S3 webservice. As a workaround, this method takes a request constructed with `multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:error:`, or any other request with an `HTTPBodyStream`, writes the contents to the specified file and returns a copy of the original request with the `HTTPBodyStream` property set to `nil`. From here, the file can either be passed to `AFURLSessionManager -uploadTaskWithRequest:fromFile:progress:completionHandler:`, or have its contents read into an `NSData` that's assigned to the `HTTPBody` property of the request.\n\n @see https://github.com/AFNetworking/AFNetworking/issues/1398\n */\n- (NSMutableURLRequest *)requestWithMultipartFormRequest:(NSURLRequest *)request\n                             writingStreamContentsToFile:(NSURL *)fileURL\n                                       completionHandler:(nullable void (^)(NSError * _Nullable error))handler;\n\n@end\n\n#pragma mark -\n\n/**\n The `AFMultipartFormData` protocol defines the methods supported by the parameter in the block argument of `AFHTTPRequestSerializer -multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:`.\n */\n@protocol AFMultipartFormData\n\n/**\n Appends the HTTP header `Content-Disposition: file; filename=#{generated filename}; name=#{name}\"` and `Content-Type: #{generated mimeType}`, followed by the encoded file data and the multipart form boundary.\n\n The filename and MIME type for this data in the form will be automatically generated, using the last path component of the `fileURL` and system associated MIME type for the `fileURL` extension, respectively.\n\n @param fileURL The URL corresponding to the file whose content will be appended to the form. This parameter must not be `nil`.\n @param name The name to be associated with the specified data. This parameter must not be `nil`.\n @param error If an error occurs, upon return contains an `NSError` object that describes the problem.\n\n @return `YES` if the file data was successfully appended, otherwise `NO`.\n */\n- (BOOL)appendPartWithFileURL:(NSURL *)fileURL\n                         name:(NSString *)name\n                        error:(NSError * _Nullable __autoreleasing *)error;\n\n/**\n Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}\"` and `Content-Type: #{mimeType}`, followed by the encoded file data and the multipart form boundary.\n\n @param fileURL The URL corresponding to the file whose content will be appended to the form. This parameter must not be `nil`.\n @param name The name to be associated with the specified data. This parameter must not be `nil`.\n @param fileName The file name to be used in the `Content-Disposition` header. This parameter must not be `nil`.\n @param mimeType The declared MIME type of the file data. This parameter must not be `nil`.\n @param error If an error occurs, upon return contains an `NSError` object that describes the problem.\n\n @return `YES` if the file data was successfully appended otherwise `NO`.\n */\n- (BOOL)appendPartWithFileURL:(NSURL *)fileURL\n                         name:(NSString *)name\n                     fileName:(NSString *)fileName\n                     mimeType:(NSString *)mimeType\n                        error:(NSError * _Nullable __autoreleasing *)error;\n\n/**\n Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}\"` and `Content-Type: #{mimeType}`, followed by the data from the input stream and the multipart form boundary.\n\n @param inputStream The input stream to be appended to the form data\n @param name The name to be associated with the specified input stream. This parameter must not be `nil`.\n @param fileName The filename to be associated with the specified input stream. This parameter must not be `nil`.\n @param length The length of the specified input stream in bytes.\n @param mimeType The MIME type of the specified data. (For example, the MIME type for a JPEG image is image/jpeg.) For a list of valid MIME types, see http://www.iana.org/assignments/media-types/. This parameter must not be `nil`.\n */\n- (void)appendPartWithInputStream:(nullable NSInputStream *)inputStream\n                             name:(NSString *)name\n                         fileName:(NSString *)fileName\n                           length:(int64_t)length\n                         mimeType:(NSString *)mimeType;\n\n/**\n Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}\"` and `Content-Type: #{mimeType}`, followed by the encoded file data and the multipart form boundary.\n\n @param data The data to be encoded and appended to the form data.\n @param name The name to be associated with the specified data. This parameter must not be `nil`.\n @param fileName The filename to be associated with the specified data. This parameter must not be `nil`.\n @param mimeType The MIME type of the specified data. (For example, the MIME type for a JPEG image is image/jpeg.) For a list of valid MIME types, see http://www.iana.org/assignments/media-types/. This parameter must not be `nil`.\n */\n- (void)appendPartWithFileData:(NSData *)data\n                          name:(NSString *)name\n                      fileName:(NSString *)fileName\n                      mimeType:(NSString *)mimeType;\n\n/**\n Appends the HTTP headers `Content-Disposition: form-data; name=#{name}\"`, followed by the encoded data and the multipart form boundary.\n\n @param data The data to be encoded and appended to the form data.\n @param name The name to be associated with the specified data. This parameter must not be `nil`.\n */\n\n- (void)appendPartWithFormData:(NSData *)data\n                          name:(NSString *)name;\n\n\n/**\n Appends HTTP headers, followed by the encoded data and the multipart form boundary.\n\n @param headers The HTTP headers to be appended to the form data.\n @param body The data to be encoded and appended to the form data. This parameter must not be `nil`.\n */\n- (void)appendPartWithHeaders:(nullable NSDictionary <NSString *, NSString *> *)headers\n                         body:(NSData *)body;\n\n/**\n Throttles request bandwidth by limiting the packet size and adding a delay for each chunk read from the upload stream.\n\n When uploading over a 3G or EDGE connection, requests may fail with \"request body stream exhausted\". Setting a maximum packet size and delay according to the recommended values (`kAFUploadStream3GSuggestedPacketSize` and `kAFUploadStream3GSuggestedDelay`) lowers the risk of the input stream exceeding its allocated bandwidth. Unfortunately, there is no definite way to distinguish between a 3G, EDGE, or LTE connection over `NSURLConnection`. As such, it is not recommended that you throttle bandwidth based solely on network reachability. Instead, you should consider checking for the \"request body stream exhausted\" in a failure block, and then retrying the request with throttled bandwidth.\n\n @param numberOfBytes Maximum packet size, in number of bytes. The default packet size for an input stream is 16kb.\n @param delay Duration of delay each time a packet is read. By default, no delay is set.\n */\n- (void)throttleBandwidthWithPacketSize:(NSUInteger)numberOfBytes\n                                  delay:(NSTimeInterval)delay;\n\n@end\n\n#pragma mark -\n\n/**\n `AFJSONRequestSerializer` is a subclass of `AFHTTPRequestSerializer` that encodes parameters as JSON using `NSJSONSerialization`, setting the `Content-Type` of the encoded request to `application/json`.\n */\n@interface AFJSONRequestSerializer : AFHTTPRequestSerializer\n\n/**\n Options for writing the request JSON data from Foundation objects. For possible values, see the `NSJSONSerialization` documentation section \"NSJSONWritingOptions\". `0` by default.\n */\n@property (nonatomic, assign) NSJSONWritingOptions writingOptions;\n\n/**\n Creates and returns a JSON serializer with specified reading and writing options.\n\n @param writingOptions The specified JSON writing options.\n */\n+ (instancetype)serializerWithWritingOptions:(NSJSONWritingOptions)writingOptions;\n\n@end\n\n#pragma mark -\n\n/**\n `AFPropertyListRequestSerializer` is a subclass of `AFHTTPRequestSerializer` that encodes parameters as JSON using `NSPropertyListSerializer`, setting the `Content-Type` of the encoded request to `application/x-plist`.\n */\n@interface AFPropertyListRequestSerializer : AFHTTPRequestSerializer\n\n/**\n The property list format. Possible values are described in \"NSPropertyListFormat\".\n */\n@property (nonatomic, assign) NSPropertyListFormat format;\n\n/**\n @warning The `writeOptions` property is currently unused.\n */\n@property (nonatomic, assign) NSPropertyListWriteOptions writeOptions;\n\n/**\n Creates and returns a property list serializer with a specified format, read options, and write options.\n\n @param format The property list format.\n @param writeOptions The property list write options.\n\n @warning The `writeOptions` property is currently unused.\n */\n+ (instancetype)serializerWithFormat:(NSPropertyListFormat)format\n                        writeOptions:(NSPropertyListWriteOptions)writeOptions;\n\n@end\n\n#pragma mark -\n\n///----------------\n/// @name Constants\n///----------------\n\n/**\n ## Error Domains\n\n The following error domain is predefined.\n\n - `NSString * const AFURLRequestSerializationErrorDomain`\n\n ### Constants\n\n `AFURLRequestSerializationErrorDomain`\n AFURLRequestSerializer errors. Error codes for `AFURLRequestSerializationErrorDomain` correspond to codes in `NSURLErrorDomain`.\n */\nFOUNDATION_EXPORT NSString * const AFURLRequestSerializationErrorDomain;\n\n/**\n ## User info dictionary keys\n\n These keys may exist in the user info dictionary, in addition to those defined for NSError.\n\n - `NSString * const AFNetworkingOperationFailingURLRequestErrorKey`\n\n ### Constants\n\n `AFNetworkingOperationFailingURLRequestErrorKey`\n The corresponding value is an `NSURLRequest` containing the request of the operation associated with an error. This key is only present in the `AFURLRequestSerializationErrorDomain`.\n */\nFOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLRequestErrorKey;\n\n/**\n ## Throttling Bandwidth for HTTP Request Input Streams\n\n @see -throttleBandwidthWithPacketSize:delay:\n\n ### Constants\n\n `kAFUploadStream3GSuggestedPacketSize`\n Maximum packet size, in number of bytes. Equal to 16kb.\n\n `kAFUploadStream3GSuggestedDelay`\n Duration of delay each time a packet is read. Equal to 0.2 seconds.\n */\nFOUNDATION_EXPORT NSUInteger const kAFUploadStream3GSuggestedPacketSize;\nFOUNDATION_EXPORT NSTimeInterval const kAFUploadStream3GSuggestedDelay;\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/AFNetworking/AFURLRequestSerialization.m",
    "content": "// AFURLRequestSerialization.m\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import \"AFURLRequestSerialization.h\"\n\n#if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV\n#import <MobileCoreServices/MobileCoreServices.h>\n#else\n#import <CoreServices/CoreServices.h>\n#endif\n\nNSString * const AFURLRequestSerializationErrorDomain = @\"com.alamofire.error.serialization.request\";\nNSString * const AFNetworkingOperationFailingURLRequestErrorKey = @\"com.alamofire.serialization.request.error.response\";\n\ntypedef NSString * (^AFQueryStringSerializationBlock)(NSURLRequest *request, id parameters, NSError *__autoreleasing *error);\n\n/**\n Returns a percent-escaped string following RFC 3986 for a query string key or value.\n RFC 3986 states that the following characters are \"reserved\" characters.\n    - General Delimiters: \":\", \"#\", \"[\", \"]\", \"@\", \"?\", \"/\"\n    - Sub-Delimiters: \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\"\n\n In RFC 3986 - Section 3.4, it states that the \"?\" and \"/\" characters should not be escaped to allow\n query strings to include a URL. Therefore, all \"reserved\" characters with the exception of \"?\" and \"/\"\n should be percent-escaped in the query string.\n    - parameter string: The string to be percent-escaped.\n    - returns: The percent-escaped string.\n */\nNSString * AFPercentEscapedStringFromString(NSString *string) {\n    static NSString * const kAFCharactersGeneralDelimitersToEncode = @\":#[]@\"; // does not include \"?\" or \"/\" due to RFC 3986 - Section 3.4\n    static NSString * const kAFCharactersSubDelimitersToEncode = @\"!$&'()*+,;=\";\n\n    NSMutableCharacterSet * allowedCharacterSet = [[NSCharacterSet URLQueryAllowedCharacterSet] mutableCopy];\n    [allowedCharacterSet removeCharactersInString:[kAFCharactersGeneralDelimitersToEncode stringByAppendingString:kAFCharactersSubDelimitersToEncode]];\n\n\t// FIXME: https://github.com/AFNetworking/AFNetworking/pull/3028\n    // return [string stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacterSet];\n\n    static NSUInteger const batchSize = 50;\n\n    NSUInteger index = 0;\n    NSMutableString *escaped = @\"\".mutableCopy;\n\n    while (index < string.length) {\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wgnu\"\n        NSUInteger length = MIN(string.length - index, batchSize);\n#pragma GCC diagnostic pop\n        NSRange range = NSMakeRange(index, length);\n\n        // To avoid breaking up character sequences such as 👴🏻👮🏽\n        range = [string rangeOfComposedCharacterSequencesForRange:range];\n\n        NSString *substring = [string substringWithRange:range];\n        NSString *encoded = [substring stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacterSet];\n        [escaped appendString:encoded];\n\n        index += range.length;\n    }\n\n\treturn escaped;\n}\n\n#pragma mark -\n\n@interface AFQueryStringPair : NSObject\n@property (readwrite, nonatomic, strong) id field;\n@property (readwrite, nonatomic, strong) id value;\n\n- (instancetype)initWithField:(id)field value:(id)value;\n\n- (NSString *)URLEncodedStringValue;\n@end\n\n@implementation AFQueryStringPair\n\n- (instancetype)initWithField:(id)field value:(id)value {\n    self = [super init];\n    if (!self) {\n        return nil;\n    }\n\n    self.field = field;\n    self.value = value;\n\n    return self;\n}\n\n- (NSString *)URLEncodedStringValue {\n    if (!self.value || [self.value isEqual:[NSNull null]]) {\n        return AFPercentEscapedStringFromString([self.field description]);\n    } else {\n        return [NSString stringWithFormat:@\"%@=%@\", AFPercentEscapedStringFromString([self.field description]), AFPercentEscapedStringFromString([self.value description])];\n    }\n}\n\n@end\n\n#pragma mark -\n\nFOUNDATION_EXPORT NSArray * AFQueryStringPairsFromDictionary(NSDictionary *dictionary);\nFOUNDATION_EXPORT NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value);\n\nNSString * AFQueryStringFromParameters(NSDictionary *parameters) {\n    NSMutableArray *mutablePairs = [NSMutableArray array];\n    for (AFQueryStringPair *pair in AFQueryStringPairsFromDictionary(parameters)) {\n        [mutablePairs addObject:[pair URLEncodedStringValue]];\n    }\n\n    return [mutablePairs componentsJoinedByString:@\"&\"];\n}\n\nNSArray * AFQueryStringPairsFromDictionary(NSDictionary *dictionary) {\n    return AFQueryStringPairsFromKeyAndValue(nil, dictionary);\n}\n\nNSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value) {\n    NSMutableArray *mutableQueryStringComponents = [NSMutableArray array];\n\n    NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@\"description\" ascending:YES selector:@selector(compare:)];\n\n    if ([value isKindOfClass:[NSDictionary class]]) {\n        NSDictionary *dictionary = value;\n        // Sort dictionary keys to ensure consistent ordering in query string, which is important when deserializing potentially ambiguous sequences, such as an array of dictionaries\n        for (id nestedKey in [dictionary.allKeys sortedArrayUsingDescriptors:@[ sortDescriptor ]]) {\n            id nestedValue = dictionary[nestedKey];\n            if (nestedValue) {\n                [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue((key ? [NSString stringWithFormat:@\"%@[%@]\", key, nestedKey] : nestedKey), nestedValue)];\n            }\n        }\n    } else if ([value isKindOfClass:[NSArray class]]) {\n        NSArray *array = value;\n        for (id nestedValue in array) {\n            [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue([NSString stringWithFormat:@\"%@[]\", key], nestedValue)];\n        }\n    } else if ([value isKindOfClass:[NSSet class]]) {\n        NSSet *set = value;\n        for (id obj in [set sortedArrayUsingDescriptors:@[ sortDescriptor ]]) {\n            [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue(key, obj)];\n        }\n    } else {\n        [mutableQueryStringComponents addObject:[[AFQueryStringPair alloc] initWithField:key value:value]];\n    }\n\n    return mutableQueryStringComponents;\n}\n\n#pragma mark -\n\n@interface AFStreamingMultipartFormData : NSObject <AFMultipartFormData>\n- (instancetype)initWithURLRequest:(NSMutableURLRequest *)urlRequest\n                    stringEncoding:(NSStringEncoding)encoding;\n\n- (NSMutableURLRequest *)requestByFinalizingMultipartFormData;\n@end\n\n#pragma mark -\n\nstatic NSArray * AFHTTPRequestSerializerObservedKeyPaths() {\n    static NSArray *_AFHTTPRequestSerializerObservedKeyPaths = nil;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        _AFHTTPRequestSerializerObservedKeyPaths = @[NSStringFromSelector(@selector(allowsCellularAccess)), NSStringFromSelector(@selector(cachePolicy)), NSStringFromSelector(@selector(HTTPShouldHandleCookies)), NSStringFromSelector(@selector(HTTPShouldUsePipelining)), NSStringFromSelector(@selector(networkServiceType)), NSStringFromSelector(@selector(timeoutInterval))];\n    });\n\n    return _AFHTTPRequestSerializerObservedKeyPaths;\n}\n\nstatic void *AFHTTPRequestSerializerObserverContext = &AFHTTPRequestSerializerObserverContext;\n\n@interface AFHTTPRequestSerializer ()\n@property (readwrite, nonatomic, strong) NSMutableSet *mutableObservedChangedKeyPaths;\n@property (readwrite, nonatomic, strong) NSMutableDictionary *mutableHTTPRequestHeaders;\n@property (readwrite, nonatomic, assign) AFHTTPRequestQueryStringSerializationStyle queryStringSerializationStyle;\n@property (readwrite, nonatomic, copy) AFQueryStringSerializationBlock queryStringSerialization;\n@end\n\n@implementation AFHTTPRequestSerializer\n\n+ (instancetype)serializer {\n    return [[self alloc] init];\n}\n\n- (instancetype)init {\n    self = [super init];\n    if (!self) {\n        return nil;\n    }\n\n    self.stringEncoding = NSUTF8StringEncoding;\n\n    self.mutableHTTPRequestHeaders = [NSMutableDictionary dictionary];\n\n    // Accept-Language HTTP Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4\n    NSMutableArray *acceptLanguagesComponents = [NSMutableArray array];\n    [[NSLocale preferredLanguages] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {\n        float q = 1.0f - (idx * 0.1f);\n        [acceptLanguagesComponents addObject:[NSString stringWithFormat:@\"%@;q=%0.1g\", obj, q]];\n        *stop = q <= 0.5f;\n    }];\n    [self setValue:[acceptLanguagesComponents componentsJoinedByString:@\", \"] forHTTPHeaderField:@\"Accept-Language\"];\n\n    NSString *userAgent = nil;\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wgnu\"\n#if TARGET_OS_IOS\n    // User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43\n    userAgent = [NSString stringWithFormat:@\"%@/%@ (%@; iOS %@; Scale/%0.2f)\", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@\"CFBundleShortVersionString\"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], [[UIScreen mainScreen] scale]];\n#elif TARGET_OS_WATCH\n    // User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43\n    userAgent = [NSString stringWithFormat:@\"%@/%@ (%@; watchOS %@; Scale/%0.2f)\", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@\"CFBundleShortVersionString\"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[WKInterfaceDevice currentDevice] model], [[WKInterfaceDevice currentDevice] systemVersion], [[WKInterfaceDevice currentDevice] screenScale]];\n#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)\n    userAgent = [NSString stringWithFormat:@\"%@/%@ (Mac OS X %@)\", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@\"CFBundleShortVersionString\"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[NSProcessInfo processInfo] operatingSystemVersionString]];\n#endif\n#pragma clang diagnostic pop\n    if (userAgent) {\n        if (![userAgent canBeConvertedToEncoding:NSASCIIStringEncoding]) {\n            NSMutableString *mutableUserAgent = [userAgent mutableCopy];\n            if (CFStringTransform((__bridge CFMutableStringRef)(mutableUserAgent), NULL, (__bridge CFStringRef)@\"Any-Latin; Latin-ASCII; [:^ASCII:] Remove\", false)) {\n                userAgent = mutableUserAgent;\n            }\n        }\n        [self setValue:userAgent forHTTPHeaderField:@\"User-Agent\"];\n    }\n\n    // HTTP Method Definitions; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html\n    self.HTTPMethodsEncodingParametersInURI = [NSSet setWithObjects:@\"GET\", @\"HEAD\", @\"DELETE\", nil];\n\n    self.mutableObservedChangedKeyPaths = [NSMutableSet set];\n    for (NSString *keyPath in AFHTTPRequestSerializerObservedKeyPaths()) {\n        if ([self respondsToSelector:NSSelectorFromString(keyPath)]) {\n            [self addObserver:self forKeyPath:keyPath options:NSKeyValueObservingOptionNew context:AFHTTPRequestSerializerObserverContext];\n        }\n    }\n\n    return self;\n}\n\n- (void)dealloc {\n    for (NSString *keyPath in AFHTTPRequestSerializerObservedKeyPaths()) {\n        if ([self respondsToSelector:NSSelectorFromString(keyPath)]) {\n            [self removeObserver:self forKeyPath:keyPath context:AFHTTPRequestSerializerObserverContext];\n        }\n    }\n}\n\n#pragma mark -\n\n// Workarounds for crashing behavior using Key-Value Observing with XCTest\n// See https://github.com/AFNetworking/AFNetworking/issues/2523\n\n- (void)setAllowsCellularAccess:(BOOL)allowsCellularAccess {\n    [self willChangeValueForKey:NSStringFromSelector(@selector(allowsCellularAccess))];\n    _allowsCellularAccess = allowsCellularAccess;\n    [self didChangeValueForKey:NSStringFromSelector(@selector(allowsCellularAccess))];\n}\n\n- (void)setCachePolicy:(NSURLRequestCachePolicy)cachePolicy {\n    [self willChangeValueForKey:NSStringFromSelector(@selector(cachePolicy))];\n    _cachePolicy = cachePolicy;\n    [self didChangeValueForKey:NSStringFromSelector(@selector(cachePolicy))];\n}\n\n- (void)setHTTPShouldHandleCookies:(BOOL)HTTPShouldHandleCookies {\n    [self willChangeValueForKey:NSStringFromSelector(@selector(HTTPShouldHandleCookies))];\n    _HTTPShouldHandleCookies = HTTPShouldHandleCookies;\n    [self didChangeValueForKey:NSStringFromSelector(@selector(HTTPShouldHandleCookies))];\n}\n\n- (void)setHTTPShouldUsePipelining:(BOOL)HTTPShouldUsePipelining {\n    [self willChangeValueForKey:NSStringFromSelector(@selector(HTTPShouldUsePipelining))];\n    _HTTPShouldUsePipelining = HTTPShouldUsePipelining;\n    [self didChangeValueForKey:NSStringFromSelector(@selector(HTTPShouldUsePipelining))];\n}\n\n- (void)setNetworkServiceType:(NSURLRequestNetworkServiceType)networkServiceType {\n    [self willChangeValueForKey:NSStringFromSelector(@selector(networkServiceType))];\n    _networkServiceType = networkServiceType;\n    [self didChangeValueForKey:NSStringFromSelector(@selector(networkServiceType))];\n}\n\n- (void)setTimeoutInterval:(NSTimeInterval)timeoutInterval {\n    [self willChangeValueForKey:NSStringFromSelector(@selector(timeoutInterval))];\n    _timeoutInterval = timeoutInterval;\n    [self didChangeValueForKey:NSStringFromSelector(@selector(timeoutInterval))];\n}\n\n#pragma mark -\n\n- (NSDictionary *)HTTPRequestHeaders {\n    return [NSDictionary dictionaryWithDictionary:self.mutableHTTPRequestHeaders];\n}\n\n- (void)setValue:(NSString *)value\nforHTTPHeaderField:(NSString *)field\n{\n\t[self.mutableHTTPRequestHeaders setValue:value forKey:field];\n}\n\n- (NSString *)valueForHTTPHeaderField:(NSString *)field {\n    return [self.mutableHTTPRequestHeaders valueForKey:field];\n}\n\n- (void)setAuthorizationHeaderFieldWithUsername:(NSString *)username\n                                       password:(NSString *)password\n{\n    NSData *basicAuthCredentials = [[NSString stringWithFormat:@\"%@:%@\", username, password] dataUsingEncoding:NSUTF8StringEncoding];\n    NSString *base64AuthCredentials = [basicAuthCredentials base64EncodedStringWithOptions:(NSDataBase64EncodingOptions)0];\n    [self setValue:[NSString stringWithFormat:@\"Basic %@\", base64AuthCredentials] forHTTPHeaderField:@\"Authorization\"];\n}\n\n- (void)clearAuthorizationHeader {\n\t[self.mutableHTTPRequestHeaders removeObjectForKey:@\"Authorization\"];\n}\n\n#pragma mark -\n\n- (void)setQueryStringSerializationWithStyle:(AFHTTPRequestQueryStringSerializationStyle)style {\n    self.queryStringSerializationStyle = style;\n    self.queryStringSerialization = nil;\n}\n\n- (void)setQueryStringSerializationWithBlock:(NSString *(^)(NSURLRequest *, id, NSError *__autoreleasing *))block {\n    self.queryStringSerialization = block;\n}\n\n#pragma mark -\n\n- (NSMutableURLRequest *)requestWithMethod:(NSString *)method\n                                 URLString:(NSString *)URLString\n                                parameters:(id)parameters\n                                     error:(NSError *__autoreleasing *)error\n{\n    NSParameterAssert(method);\n    NSParameterAssert(URLString);\n\n    NSURL *url = [NSURL URLWithString:URLString];\n\n    NSParameterAssert(url);\n\n    NSMutableURLRequest *mutableRequest = [[NSMutableURLRequest alloc] initWithURL:url];\n    mutableRequest.HTTPMethod = method;\n\n    for (NSString *keyPath in AFHTTPRequestSerializerObservedKeyPaths()) {\n        if ([self.mutableObservedChangedKeyPaths containsObject:keyPath]) {\n            [mutableRequest setValue:[self valueForKeyPath:keyPath] forKey:keyPath];\n        }\n    }\n\n    mutableRequest = [[self requestBySerializingRequest:mutableRequest withParameters:parameters error:error] mutableCopy];\n\n\treturn mutableRequest;\n}\n\n- (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)method\n                                              URLString:(NSString *)URLString\n                                             parameters:(NSDictionary *)parameters\n                              constructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData))block\n                                                  error:(NSError *__autoreleasing *)error\n{\n    NSParameterAssert(method);\n    NSParameterAssert(![method isEqualToString:@\"GET\"] && ![method isEqualToString:@\"HEAD\"]);\n\n    NSMutableURLRequest *mutableRequest = [self requestWithMethod:method URLString:URLString parameters:nil error:error];\n\n    __block AFStreamingMultipartFormData *formData = [[AFStreamingMultipartFormData alloc] initWithURLRequest:mutableRequest stringEncoding:NSUTF8StringEncoding];\n\n    if (parameters) {\n        for (AFQueryStringPair *pair in AFQueryStringPairsFromDictionary(parameters)) {\n            NSData *data = nil;\n            if ([pair.value isKindOfClass:[NSData class]]) {\n                data = pair.value;\n            } else if ([pair.value isEqual:[NSNull null]]) {\n                data = [NSData data];\n            } else {\n                data = [[pair.value description] dataUsingEncoding:self.stringEncoding];\n            }\n\n            if (data) {\n                [formData appendPartWithFormData:data name:[pair.field description]];\n            }\n        }\n    }\n\n    if (block) {\n        block(formData);\n    }\n\n    return [formData requestByFinalizingMultipartFormData];\n}\n\n- (NSMutableURLRequest *)requestWithMultipartFormRequest:(NSURLRequest *)request\n                             writingStreamContentsToFile:(NSURL *)fileURL\n                                       completionHandler:(void (^)(NSError *error))handler\n{\n    NSParameterAssert(request.HTTPBodyStream);\n    NSParameterAssert([fileURL isFileURL]);\n\n    NSInputStream *inputStream = request.HTTPBodyStream;\n    NSOutputStream *outputStream = [[NSOutputStream alloc] initWithURL:fileURL append:NO];\n    __block NSError *error = nil;\n\n    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{\n        [inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];\n        [outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];\n\n        [inputStream open];\n        [outputStream open];\n\n        while ([inputStream hasBytesAvailable] && [outputStream hasSpaceAvailable]) {\n            uint8_t buffer[1024];\n\n            NSInteger bytesRead = [inputStream read:buffer maxLength:1024];\n            if (inputStream.streamError || bytesRead < 0) {\n                error = inputStream.streamError;\n                break;\n            }\n\n            NSInteger bytesWritten = [outputStream write:buffer maxLength:(NSUInteger)bytesRead];\n            if (outputStream.streamError || bytesWritten < 0) {\n                error = outputStream.streamError;\n                break;\n            }\n\n            if (bytesRead == 0 && bytesWritten == 0) {\n                break;\n            }\n        }\n\n        [outputStream close];\n        [inputStream close];\n\n        if (handler) {\n            dispatch_async(dispatch_get_main_queue(), ^{\n                handler(error);\n            });\n        }\n    });\n\n    NSMutableURLRequest *mutableRequest = [request mutableCopy];\n    mutableRequest.HTTPBodyStream = nil;\n\n    return mutableRequest;\n}\n\n#pragma mark - AFURLRequestSerialization\n\n- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request\n                               withParameters:(id)parameters\n                                        error:(NSError *__autoreleasing *)error\n{\n    NSParameterAssert(request);\n\n    NSMutableURLRequest *mutableRequest = [request mutableCopy];\n\n    [self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL * __unused stop) {\n        if (![request valueForHTTPHeaderField:field]) {\n            [mutableRequest setValue:value forHTTPHeaderField:field];\n        }\n    }];\n\n    NSString *query = nil;\n    if (parameters) {\n        if (self.queryStringSerialization) {\n            NSError *serializationError;\n            query = self.queryStringSerialization(request, parameters, &serializationError);\n\n            if (serializationError) {\n                if (error) {\n                    *error = serializationError;\n                }\n\n                return nil;\n            }\n        } else {\n            switch (self.queryStringSerializationStyle) {\n                case AFHTTPRequestQueryStringDefaultStyle:\n                    query = AFQueryStringFromParameters(parameters);\n                    break;\n            }\n        }\n    }\n\n    if ([self.HTTPMethodsEncodingParametersInURI containsObject:[[request HTTPMethod] uppercaseString]]) {\n        if (query && query.length > 0) {\n            mutableRequest.URL = [NSURL URLWithString:[[mutableRequest.URL absoluteString] stringByAppendingFormat:mutableRequest.URL.query ? @\"&%@\" : @\"?%@\", query]];\n        }\n    } else {\n        // #2864: an empty string is a valid x-www-form-urlencoded payload\n        if (!query) {\n            query = @\"\";\n        }\n        if (![mutableRequest valueForHTTPHeaderField:@\"Content-Type\"]) {\n            [mutableRequest setValue:@\"application/x-www-form-urlencoded\" forHTTPHeaderField:@\"Content-Type\"];\n        }\n        [mutableRequest setHTTPBody:[query dataUsingEncoding:self.stringEncoding]];\n    }\n\n    return mutableRequest;\n}\n\n#pragma mark - NSKeyValueObserving\n\n+ (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key {\n    if ([AFHTTPRequestSerializerObservedKeyPaths() containsObject:key]) {\n        return NO;\n    }\n\n    return [super automaticallyNotifiesObserversForKey:key];\n}\n\n- (void)observeValueForKeyPath:(NSString *)keyPath\n                      ofObject:(__unused id)object\n                        change:(NSDictionary *)change\n                       context:(void *)context\n{\n    if (context == AFHTTPRequestSerializerObserverContext) {\n        if ([change[NSKeyValueChangeNewKey] isEqual:[NSNull null]]) {\n            [self.mutableObservedChangedKeyPaths removeObject:keyPath];\n        } else {\n            [self.mutableObservedChangedKeyPaths addObject:keyPath];\n        }\n    }\n}\n\n#pragma mark - NSSecureCoding\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n- (instancetype)initWithCoder:(NSCoder *)decoder {\n    self = [self init];\n    if (!self) {\n        return nil;\n    }\n\n    self.mutableHTTPRequestHeaders = [[decoder decodeObjectOfClass:[NSDictionary class] forKey:NSStringFromSelector(@selector(mutableHTTPRequestHeaders))] mutableCopy];\n    self.queryStringSerializationStyle = (AFHTTPRequestQueryStringSerializationStyle)[[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(queryStringSerializationStyle))] unsignedIntegerValue];\n\n    return self;\n}\n\n- (void)encodeWithCoder:(NSCoder *)coder {\n    [coder encodeObject:self.mutableHTTPRequestHeaders forKey:NSStringFromSelector(@selector(mutableHTTPRequestHeaders))];\n    [coder encodeInteger:self.queryStringSerializationStyle forKey:NSStringFromSelector(@selector(queryStringSerializationStyle))];\n}\n\n#pragma mark - NSCopying\n\n- (instancetype)copyWithZone:(NSZone *)zone {\n    AFHTTPRequestSerializer *serializer = [[[self class] allocWithZone:zone] init];\n    serializer.mutableHTTPRequestHeaders = [self.mutableHTTPRequestHeaders mutableCopyWithZone:zone];\n    serializer.queryStringSerializationStyle = self.queryStringSerializationStyle;\n    serializer.queryStringSerialization = self.queryStringSerialization;\n\n    return serializer;\n}\n\n@end\n\n#pragma mark -\n\nstatic NSString * AFCreateMultipartFormBoundary() {\n    return [NSString stringWithFormat:@\"Boundary+%08X%08X\", arc4random(), arc4random()];\n}\n\nstatic NSString * const kAFMultipartFormCRLF = @\"\\r\\n\";\n\nstatic inline NSString * AFMultipartFormInitialBoundary(NSString *boundary) {\n    return [NSString stringWithFormat:@\"--%@%@\", boundary, kAFMultipartFormCRLF];\n}\n\nstatic inline NSString * AFMultipartFormEncapsulationBoundary(NSString *boundary) {\n    return [NSString stringWithFormat:@\"%@--%@%@\", kAFMultipartFormCRLF, boundary, kAFMultipartFormCRLF];\n}\n\nstatic inline NSString * AFMultipartFormFinalBoundary(NSString *boundary) {\n    return [NSString stringWithFormat:@\"%@--%@--%@\", kAFMultipartFormCRLF, boundary, kAFMultipartFormCRLF];\n}\n\nstatic inline NSString * AFContentTypeForPathExtension(NSString *extension) {\n    NSString *UTI = (__bridge_transfer NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)extension, NULL);\n    NSString *contentType = (__bridge_transfer NSString *)UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)UTI, kUTTagClassMIMEType);\n    if (!contentType) {\n        return @\"application/octet-stream\";\n    } else {\n        return contentType;\n    }\n}\n\nNSUInteger const kAFUploadStream3GSuggestedPacketSize = 1024 * 16;\nNSTimeInterval const kAFUploadStream3GSuggestedDelay = 0.2;\n\n@interface AFHTTPBodyPart : NSObject\n@property (nonatomic, assign) NSStringEncoding stringEncoding;\n@property (nonatomic, strong) NSDictionary *headers;\n@property (nonatomic, copy) NSString *boundary;\n@property (nonatomic, strong) id body;\n@property (nonatomic, assign) unsigned long long bodyContentLength;\n@property (nonatomic, strong) NSInputStream *inputStream;\n\n@property (nonatomic, assign) BOOL hasInitialBoundary;\n@property (nonatomic, assign) BOOL hasFinalBoundary;\n\n@property (readonly, nonatomic, assign, getter = hasBytesAvailable) BOOL bytesAvailable;\n@property (readonly, nonatomic, assign) unsigned long long contentLength;\n\n- (NSInteger)read:(uint8_t *)buffer\n        maxLength:(NSUInteger)length;\n@end\n\n@interface AFMultipartBodyStream : NSInputStream <NSStreamDelegate>\n@property (nonatomic, assign) NSUInteger numberOfBytesInPacket;\n@property (nonatomic, assign) NSTimeInterval delay;\n@property (nonatomic, strong) NSInputStream *inputStream;\n@property (readonly, nonatomic, assign) unsigned long long contentLength;\n@property (readonly, nonatomic, assign, getter = isEmpty) BOOL empty;\n\n- (instancetype)initWithStringEncoding:(NSStringEncoding)encoding;\n- (void)setInitialAndFinalBoundaries;\n- (void)appendHTTPBodyPart:(AFHTTPBodyPart *)bodyPart;\n@end\n\n#pragma mark -\n\n@interface AFStreamingMultipartFormData ()\n@property (readwrite, nonatomic, copy) NSMutableURLRequest *request;\n@property (readwrite, nonatomic, assign) NSStringEncoding stringEncoding;\n@property (readwrite, nonatomic, copy) NSString *boundary;\n@property (readwrite, nonatomic, strong) AFMultipartBodyStream *bodyStream;\n@end\n\n@implementation AFStreamingMultipartFormData\n\n- (instancetype)initWithURLRequest:(NSMutableURLRequest *)urlRequest\n                    stringEncoding:(NSStringEncoding)encoding\n{\n    self = [super init];\n    if (!self) {\n        return nil;\n    }\n\n    self.request = urlRequest;\n    self.stringEncoding = encoding;\n    self.boundary = AFCreateMultipartFormBoundary();\n    self.bodyStream = [[AFMultipartBodyStream alloc] initWithStringEncoding:encoding];\n\n    return self;\n}\n\n- (BOOL)appendPartWithFileURL:(NSURL *)fileURL\n                         name:(NSString *)name\n                        error:(NSError * __autoreleasing *)error\n{\n    NSParameterAssert(fileURL);\n    NSParameterAssert(name);\n\n    NSString *fileName = [fileURL lastPathComponent];\n    NSString *mimeType = AFContentTypeForPathExtension([fileURL pathExtension]);\n\n    return [self appendPartWithFileURL:fileURL name:name fileName:fileName mimeType:mimeType error:error];\n}\n\n- (BOOL)appendPartWithFileURL:(NSURL *)fileURL\n                         name:(NSString *)name\n                     fileName:(NSString *)fileName\n                     mimeType:(NSString *)mimeType\n                        error:(NSError * __autoreleasing *)error\n{\n    NSParameterAssert(fileURL);\n    NSParameterAssert(name);\n    NSParameterAssert(fileName);\n    NSParameterAssert(mimeType);\n\n    if (![fileURL isFileURL]) {\n        NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: NSLocalizedStringFromTable(@\"Expected URL to be a file URL\", @\"AFNetworking\", nil)};\n        if (error) {\n            *error = [[NSError alloc] initWithDomain:AFURLRequestSerializationErrorDomain code:NSURLErrorBadURL userInfo:userInfo];\n        }\n\n        return NO;\n    } else if ([fileURL checkResourceIsReachableAndReturnError:error] == NO) {\n        NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: NSLocalizedStringFromTable(@\"File URL not reachable.\", @\"AFNetworking\", nil)};\n        if (error) {\n            *error = [[NSError alloc] initWithDomain:AFURLRequestSerializationErrorDomain code:NSURLErrorBadURL userInfo:userInfo];\n        }\n\n        return NO;\n    }\n\n    NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:[fileURL path] error:error];\n    if (!fileAttributes) {\n        return NO;\n    }\n\n    NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary];\n    [mutableHeaders setValue:[NSString stringWithFormat:@\"form-data; name=\\\"%@\\\"; filename=\\\"%@\\\"\", name, fileName] forKey:@\"Content-Disposition\"];\n    [mutableHeaders setValue:mimeType forKey:@\"Content-Type\"];\n\n    AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init];\n    bodyPart.stringEncoding = self.stringEncoding;\n    bodyPart.headers = mutableHeaders;\n    bodyPart.boundary = self.boundary;\n    bodyPart.body = fileURL;\n    bodyPart.bodyContentLength = [fileAttributes[NSFileSize] unsignedLongLongValue];\n    [self.bodyStream appendHTTPBodyPart:bodyPart];\n\n    return YES;\n}\n\n- (void)appendPartWithInputStream:(NSInputStream *)inputStream\n                             name:(NSString *)name\n                         fileName:(NSString *)fileName\n                           length:(int64_t)length\n                         mimeType:(NSString *)mimeType\n{\n    NSParameterAssert(name);\n    NSParameterAssert(fileName);\n    NSParameterAssert(mimeType);\n\n    NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary];\n    [mutableHeaders setValue:[NSString stringWithFormat:@\"form-data; name=\\\"%@\\\"; filename=\\\"%@\\\"\", name, fileName] forKey:@\"Content-Disposition\"];\n    [mutableHeaders setValue:mimeType forKey:@\"Content-Type\"];\n\n    AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init];\n    bodyPart.stringEncoding = self.stringEncoding;\n    bodyPart.headers = mutableHeaders;\n    bodyPart.boundary = self.boundary;\n    bodyPart.body = inputStream;\n\n    bodyPart.bodyContentLength = (unsigned long long)length;\n\n    [self.bodyStream appendHTTPBodyPart:bodyPart];\n}\n\n- (void)appendPartWithFileData:(NSData *)data\n                          name:(NSString *)name\n                      fileName:(NSString *)fileName\n                      mimeType:(NSString *)mimeType\n{\n    NSParameterAssert(name);\n    NSParameterAssert(fileName);\n    NSParameterAssert(mimeType);\n\n    NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary];\n    [mutableHeaders setValue:[NSString stringWithFormat:@\"form-data; name=\\\"%@\\\"; filename=\\\"%@\\\"\", name, fileName] forKey:@\"Content-Disposition\"];\n    [mutableHeaders setValue:mimeType forKey:@\"Content-Type\"];\n\n    [self appendPartWithHeaders:mutableHeaders body:data];\n}\n\n- (void)appendPartWithFormData:(NSData *)data\n                          name:(NSString *)name\n{\n    NSParameterAssert(name);\n\n    NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary];\n    [mutableHeaders setValue:[NSString stringWithFormat:@\"form-data; name=\\\"%@\\\"\", name] forKey:@\"Content-Disposition\"];\n\n    [self appendPartWithHeaders:mutableHeaders body:data];\n}\n\n- (void)appendPartWithHeaders:(NSDictionary *)headers\n                         body:(NSData *)body\n{\n    NSParameterAssert(body);\n\n    AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init];\n    bodyPart.stringEncoding = self.stringEncoding;\n    bodyPart.headers = headers;\n    bodyPart.boundary = self.boundary;\n    bodyPart.bodyContentLength = [body length];\n    bodyPart.body = body;\n\n    [self.bodyStream appendHTTPBodyPart:bodyPart];\n}\n\n- (void)throttleBandwidthWithPacketSize:(NSUInteger)numberOfBytes\n                                  delay:(NSTimeInterval)delay\n{\n    self.bodyStream.numberOfBytesInPacket = numberOfBytes;\n    self.bodyStream.delay = delay;\n}\n\n- (NSMutableURLRequest *)requestByFinalizingMultipartFormData {\n    if ([self.bodyStream isEmpty]) {\n        return self.request;\n    }\n\n    // Reset the initial and final boundaries to ensure correct Content-Length\n    [self.bodyStream setInitialAndFinalBoundaries];\n    [self.request setHTTPBodyStream:self.bodyStream];\n\n    [self.request setValue:[NSString stringWithFormat:@\"multipart/form-data; boundary=%@\", self.boundary] forHTTPHeaderField:@\"Content-Type\"];\n    [self.request setValue:[NSString stringWithFormat:@\"%llu\", [self.bodyStream contentLength]] forHTTPHeaderField:@\"Content-Length\"];\n\n    return self.request;\n}\n\n@end\n\n#pragma mark -\n\n@interface NSStream ()\n@property (readwrite) NSStreamStatus streamStatus;\n@property (readwrite, copy) NSError *streamError;\n@end\n\n@interface AFMultipartBodyStream () <NSCopying>\n@property (readwrite, nonatomic, assign) NSStringEncoding stringEncoding;\n@property (readwrite, nonatomic, strong) NSMutableArray *HTTPBodyParts;\n@property (readwrite, nonatomic, strong) NSEnumerator *HTTPBodyPartEnumerator;\n@property (readwrite, nonatomic, strong) AFHTTPBodyPart *currentHTTPBodyPart;\n@property (readwrite, nonatomic, strong) NSOutputStream *outputStream;\n@property (readwrite, nonatomic, strong) NSMutableData *buffer;\n@end\n\n@implementation AFMultipartBodyStream\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wimplicit-atomic-properties\"\n#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000) || (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1100)\n@synthesize delegate;\n#endif\n@synthesize streamStatus;\n@synthesize streamError;\n#pragma clang diagnostic pop\n\n- (instancetype)initWithStringEncoding:(NSStringEncoding)encoding {\n    self = [super init];\n    if (!self) {\n        return nil;\n    }\n\n    self.stringEncoding = encoding;\n    self.HTTPBodyParts = [NSMutableArray array];\n    self.numberOfBytesInPacket = NSIntegerMax;\n\n    return self;\n}\n\n- (void)setInitialAndFinalBoundaries {\n    if ([self.HTTPBodyParts count] > 0) {\n        for (AFHTTPBodyPart *bodyPart in self.HTTPBodyParts) {\n            bodyPart.hasInitialBoundary = NO;\n            bodyPart.hasFinalBoundary = NO;\n        }\n\n        [[self.HTTPBodyParts firstObject] setHasInitialBoundary:YES];\n        [[self.HTTPBodyParts lastObject] setHasFinalBoundary:YES];\n    }\n}\n\n- (void)appendHTTPBodyPart:(AFHTTPBodyPart *)bodyPart {\n    [self.HTTPBodyParts addObject:bodyPart];\n}\n\n- (BOOL)isEmpty {\n    return [self.HTTPBodyParts count] == 0;\n}\n\n#pragma mark - NSInputStream\n\n- (NSInteger)read:(uint8_t *)buffer\n        maxLength:(NSUInteger)length\n{\n    if ([self streamStatus] == NSStreamStatusClosed) {\n        return 0;\n    }\n\n    NSInteger totalNumberOfBytesRead = 0;\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wgnu\"\n    while ((NSUInteger)totalNumberOfBytesRead < MIN(length, self.numberOfBytesInPacket)) {\n        if (!self.currentHTTPBodyPart || ![self.currentHTTPBodyPart hasBytesAvailable]) {\n            if (!(self.currentHTTPBodyPart = [self.HTTPBodyPartEnumerator nextObject])) {\n                break;\n            }\n        } else {\n            NSUInteger maxLength = MIN(length, self.numberOfBytesInPacket) - (NSUInteger)totalNumberOfBytesRead;\n            NSInteger numberOfBytesRead = [self.currentHTTPBodyPart read:&buffer[totalNumberOfBytesRead] maxLength:maxLength];\n            if (numberOfBytesRead == -1) {\n                self.streamError = self.currentHTTPBodyPart.inputStream.streamError;\n                break;\n            } else {\n                totalNumberOfBytesRead += numberOfBytesRead;\n\n                if (self.delay > 0.0f) {\n                    [NSThread sleepForTimeInterval:self.delay];\n                }\n            }\n        }\n    }\n#pragma clang diagnostic pop\n\n    return totalNumberOfBytesRead;\n}\n\n- (BOOL)getBuffer:(__unused uint8_t **)buffer\n           length:(__unused NSUInteger *)len\n{\n    return NO;\n}\n\n- (BOOL)hasBytesAvailable {\n    return [self streamStatus] == NSStreamStatusOpen;\n}\n\n#pragma mark - NSStream\n\n- (void)open {\n    if (self.streamStatus == NSStreamStatusOpen) {\n        return;\n    }\n\n    self.streamStatus = NSStreamStatusOpen;\n\n    [self setInitialAndFinalBoundaries];\n    self.HTTPBodyPartEnumerator = [self.HTTPBodyParts objectEnumerator];\n}\n\n- (void)close {\n    self.streamStatus = NSStreamStatusClosed;\n}\n\n- (id)propertyForKey:(__unused NSString *)key {\n    return nil;\n}\n\n- (BOOL)setProperty:(__unused id)property\n             forKey:(__unused NSString *)key\n{\n    return NO;\n}\n\n- (void)scheduleInRunLoop:(__unused NSRunLoop *)aRunLoop\n                  forMode:(__unused NSString *)mode\n{}\n\n- (void)removeFromRunLoop:(__unused NSRunLoop *)aRunLoop\n                  forMode:(__unused NSString *)mode\n{}\n\n- (unsigned long long)contentLength {\n    unsigned long long length = 0;\n    for (AFHTTPBodyPart *bodyPart in self.HTTPBodyParts) {\n        length += [bodyPart contentLength];\n    }\n\n    return length;\n}\n\n#pragma mark - Undocumented CFReadStream Bridged Methods\n\n- (void)_scheduleInCFRunLoop:(__unused CFRunLoopRef)aRunLoop\n                     forMode:(__unused CFStringRef)aMode\n{}\n\n- (void)_unscheduleFromCFRunLoop:(__unused CFRunLoopRef)aRunLoop\n                         forMode:(__unused CFStringRef)aMode\n{}\n\n- (BOOL)_setCFClientFlags:(__unused CFOptionFlags)inFlags\n                 callback:(__unused CFReadStreamClientCallBack)inCallback\n                  context:(__unused CFStreamClientContext *)inContext {\n    return NO;\n}\n\n#pragma mark - NSCopying\n\n- (instancetype)copyWithZone:(NSZone *)zone {\n    AFMultipartBodyStream *bodyStreamCopy = [[[self class] allocWithZone:zone] initWithStringEncoding:self.stringEncoding];\n\n    for (AFHTTPBodyPart *bodyPart in self.HTTPBodyParts) {\n        [bodyStreamCopy appendHTTPBodyPart:[bodyPart copy]];\n    }\n\n    [bodyStreamCopy setInitialAndFinalBoundaries];\n\n    return bodyStreamCopy;\n}\n\n@end\n\n#pragma mark -\n\ntypedef enum {\n    AFEncapsulationBoundaryPhase = 1,\n    AFHeaderPhase                = 2,\n    AFBodyPhase                  = 3,\n    AFFinalBoundaryPhase         = 4,\n} AFHTTPBodyPartReadPhase;\n\n@interface AFHTTPBodyPart () <NSCopying> {\n    AFHTTPBodyPartReadPhase _phase;\n    NSInputStream *_inputStream;\n    unsigned long long _phaseReadOffset;\n}\n\n- (BOOL)transitionToNextPhase;\n- (NSInteger)readData:(NSData *)data\n           intoBuffer:(uint8_t *)buffer\n            maxLength:(NSUInteger)length;\n@end\n\n@implementation AFHTTPBodyPart\n\n- (instancetype)init {\n    self = [super init];\n    if (!self) {\n        return nil;\n    }\n\n    [self transitionToNextPhase];\n\n    return self;\n}\n\n- (void)dealloc {\n    if (_inputStream) {\n        [_inputStream close];\n        _inputStream = nil;\n    }\n}\n\n- (NSInputStream *)inputStream {\n    if (!_inputStream) {\n        if ([self.body isKindOfClass:[NSData class]]) {\n            _inputStream = [NSInputStream inputStreamWithData:self.body];\n        } else if ([self.body isKindOfClass:[NSURL class]]) {\n            _inputStream = [NSInputStream inputStreamWithURL:self.body];\n        } else if ([self.body isKindOfClass:[NSInputStream class]]) {\n            _inputStream = self.body;\n        } else {\n            _inputStream = [NSInputStream inputStreamWithData:[NSData data]];\n        }\n    }\n\n    return _inputStream;\n}\n\n- (NSString *)stringForHeaders {\n    NSMutableString *headerString = [NSMutableString string];\n    for (NSString *field in [self.headers allKeys]) {\n        [headerString appendString:[NSString stringWithFormat:@\"%@: %@%@\", field, [self.headers valueForKey:field], kAFMultipartFormCRLF]];\n    }\n    [headerString appendString:kAFMultipartFormCRLF];\n\n    return [NSString stringWithString:headerString];\n}\n\n- (unsigned long long)contentLength {\n    unsigned long long length = 0;\n\n    NSData *encapsulationBoundaryData = [([self hasInitialBoundary] ? AFMultipartFormInitialBoundary(self.boundary) : AFMultipartFormEncapsulationBoundary(self.boundary)) dataUsingEncoding:self.stringEncoding];\n    length += [encapsulationBoundaryData length];\n\n    NSData *headersData = [[self stringForHeaders] dataUsingEncoding:self.stringEncoding];\n    length += [headersData length];\n\n    length += _bodyContentLength;\n\n    NSData *closingBoundaryData = ([self hasFinalBoundary] ? [AFMultipartFormFinalBoundary(self.boundary) dataUsingEncoding:self.stringEncoding] : [NSData data]);\n    length += [closingBoundaryData length];\n\n    return length;\n}\n\n- (BOOL)hasBytesAvailable {\n    // Allows `read:maxLength:` to be called again if `AFMultipartFormFinalBoundary` doesn't fit into the available buffer\n    if (_phase == AFFinalBoundaryPhase) {\n        return YES;\n    }\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wcovered-switch-default\"\n    switch (self.inputStream.streamStatus) {\n        case NSStreamStatusNotOpen:\n        case NSStreamStatusOpening:\n        case NSStreamStatusOpen:\n        case NSStreamStatusReading:\n        case NSStreamStatusWriting:\n            return YES;\n        case NSStreamStatusAtEnd:\n        case NSStreamStatusClosed:\n        case NSStreamStatusError:\n        default:\n            return NO;\n    }\n#pragma clang diagnostic pop\n}\n\n- (NSInteger)read:(uint8_t *)buffer\n        maxLength:(NSUInteger)length\n{\n    NSInteger totalNumberOfBytesRead = 0;\n\n    if (_phase == AFEncapsulationBoundaryPhase) {\n        NSData *encapsulationBoundaryData = [([self hasInitialBoundary] ? AFMultipartFormInitialBoundary(self.boundary) : AFMultipartFormEncapsulationBoundary(self.boundary)) dataUsingEncoding:self.stringEncoding];\n        totalNumberOfBytesRead += [self readData:encapsulationBoundaryData intoBuffer:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)];\n    }\n\n    if (_phase == AFHeaderPhase) {\n        NSData *headersData = [[self stringForHeaders] dataUsingEncoding:self.stringEncoding];\n        totalNumberOfBytesRead += [self readData:headersData intoBuffer:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)];\n    }\n\n    if (_phase == AFBodyPhase) {\n        NSInteger numberOfBytesRead = 0;\n\n        numberOfBytesRead = [self.inputStream read:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)];\n        if (numberOfBytesRead == -1) {\n            return -1;\n        } else {\n            totalNumberOfBytesRead += numberOfBytesRead;\n\n            if ([self.inputStream streamStatus] >= NSStreamStatusAtEnd) {\n                [self transitionToNextPhase];\n            }\n        }\n    }\n\n    if (_phase == AFFinalBoundaryPhase) {\n        NSData *closingBoundaryData = ([self hasFinalBoundary] ? [AFMultipartFormFinalBoundary(self.boundary) dataUsingEncoding:self.stringEncoding] : [NSData data]);\n        totalNumberOfBytesRead += [self readData:closingBoundaryData intoBuffer:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)];\n    }\n\n    return totalNumberOfBytesRead;\n}\n\n- (NSInteger)readData:(NSData *)data\n           intoBuffer:(uint8_t *)buffer\n            maxLength:(NSUInteger)length\n{\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wgnu\"\n    NSRange range = NSMakeRange((NSUInteger)_phaseReadOffset, MIN([data length] - ((NSUInteger)_phaseReadOffset), length));\n    [data getBytes:buffer range:range];\n#pragma clang diagnostic pop\n\n    _phaseReadOffset += range.length;\n\n    if (((NSUInteger)_phaseReadOffset) >= [data length]) {\n        [self transitionToNextPhase];\n    }\n\n    return (NSInteger)range.length;\n}\n\n- (BOOL)transitionToNextPhase {\n    if (![[NSThread currentThread] isMainThread]) {\n        dispatch_sync(dispatch_get_main_queue(), ^{\n            [self transitionToNextPhase];\n        });\n        return YES;\n    }\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wcovered-switch-default\"\n    switch (_phase) {\n        case AFEncapsulationBoundaryPhase:\n            _phase = AFHeaderPhase;\n            break;\n        case AFHeaderPhase:\n            [self.inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];\n            [self.inputStream open];\n            _phase = AFBodyPhase;\n            break;\n        case AFBodyPhase:\n            [self.inputStream close];\n            _phase = AFFinalBoundaryPhase;\n            break;\n        case AFFinalBoundaryPhase:\n        default:\n            _phase = AFEncapsulationBoundaryPhase;\n            break;\n    }\n    _phaseReadOffset = 0;\n#pragma clang diagnostic pop\n\n    return YES;\n}\n\n#pragma mark - NSCopying\n\n- (instancetype)copyWithZone:(NSZone *)zone {\n    AFHTTPBodyPart *bodyPart = [[[self class] allocWithZone:zone] init];\n\n    bodyPart.stringEncoding = self.stringEncoding;\n    bodyPart.headers = self.headers;\n    bodyPart.bodyContentLength = self.bodyContentLength;\n    bodyPart.body = self.body;\n    bodyPart.boundary = self.boundary;\n\n    return bodyPart;\n}\n\n@end\n\n#pragma mark -\n\n@implementation AFJSONRequestSerializer\n\n+ (instancetype)serializer {\n    return [self serializerWithWritingOptions:(NSJSONWritingOptions)0];\n}\n\n+ (instancetype)serializerWithWritingOptions:(NSJSONWritingOptions)writingOptions\n{\n    AFJSONRequestSerializer *serializer = [[self alloc] init];\n    serializer.writingOptions = writingOptions;\n\n    return serializer;\n}\n\n#pragma mark - AFURLRequestSerialization\n\n- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request\n                               withParameters:(id)parameters\n                                        error:(NSError *__autoreleasing *)error\n{\n    NSParameterAssert(request);\n\n    if ([self.HTTPMethodsEncodingParametersInURI containsObject:[[request HTTPMethod] uppercaseString]]) {\n        return [super requestBySerializingRequest:request withParameters:parameters error:error];\n    }\n\n    NSMutableURLRequest *mutableRequest = [request mutableCopy];\n\n    [self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL * __unused stop) {\n        if (![request valueForHTTPHeaderField:field]) {\n            [mutableRequest setValue:value forHTTPHeaderField:field];\n        }\n    }];\n\n    if (parameters) {\n        if (![mutableRequest valueForHTTPHeaderField:@\"Content-Type\"]) {\n            [mutableRequest setValue:@\"application/json\" forHTTPHeaderField:@\"Content-Type\"];\n        }\n\n        [mutableRequest setHTTPBody:[NSJSONSerialization dataWithJSONObject:parameters options:self.writingOptions error:error]];\n    }\n\n    return mutableRequest;\n}\n\n#pragma mark - NSSecureCoding\n\n- (instancetype)initWithCoder:(NSCoder *)decoder {\n    self = [super initWithCoder:decoder];\n    if (!self) {\n        return nil;\n    }\n\n    self.writingOptions = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(writingOptions))] unsignedIntegerValue];\n\n    return self;\n}\n\n- (void)encodeWithCoder:(NSCoder *)coder {\n    [super encodeWithCoder:coder];\n\n    [coder encodeInteger:self.writingOptions forKey:NSStringFromSelector(@selector(writingOptions))];\n}\n\n#pragma mark - NSCopying\n\n- (instancetype)copyWithZone:(NSZone *)zone {\n    AFJSONRequestSerializer *serializer = [super copyWithZone:zone];\n    serializer.writingOptions = self.writingOptions;\n\n    return serializer;\n}\n\n@end\n\n#pragma mark -\n\n@implementation AFPropertyListRequestSerializer\n\n+ (instancetype)serializer {\n    return [self serializerWithFormat:NSPropertyListXMLFormat_v1_0 writeOptions:0];\n}\n\n+ (instancetype)serializerWithFormat:(NSPropertyListFormat)format\n                        writeOptions:(NSPropertyListWriteOptions)writeOptions\n{\n    AFPropertyListRequestSerializer *serializer = [[self alloc] init];\n    serializer.format = format;\n    serializer.writeOptions = writeOptions;\n\n    return serializer;\n}\n\n#pragma mark - AFURLRequestSerializer\n\n- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request\n                               withParameters:(id)parameters\n                                        error:(NSError *__autoreleasing *)error\n{\n    NSParameterAssert(request);\n\n    if ([self.HTTPMethodsEncodingParametersInURI containsObject:[[request HTTPMethod] uppercaseString]]) {\n        return [super requestBySerializingRequest:request withParameters:parameters error:error];\n    }\n\n    NSMutableURLRequest *mutableRequest = [request mutableCopy];\n\n    [self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL * __unused stop) {\n        if (![request valueForHTTPHeaderField:field]) {\n            [mutableRequest setValue:value forHTTPHeaderField:field];\n        }\n    }];\n\n    if (parameters) {\n        if (![mutableRequest valueForHTTPHeaderField:@\"Content-Type\"]) {\n            [mutableRequest setValue:@\"application/x-plist\" forHTTPHeaderField:@\"Content-Type\"];\n        }\n\n        [mutableRequest setHTTPBody:[NSPropertyListSerialization dataWithPropertyList:parameters format:self.format options:self.writeOptions error:error]];\n    }\n\n    return mutableRequest;\n}\n\n#pragma mark - NSSecureCoding\n\n- (instancetype)initWithCoder:(NSCoder *)decoder {\n    self = [super initWithCoder:decoder];\n    if (!self) {\n        return nil;\n    }\n\n    self.format = (NSPropertyListFormat)[[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(format))] unsignedIntegerValue];\n    self.writeOptions = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(writeOptions))] unsignedIntegerValue];\n\n    return self;\n}\n\n- (void)encodeWithCoder:(NSCoder *)coder {\n    [super encodeWithCoder:coder];\n\n    [coder encodeInteger:self.format forKey:NSStringFromSelector(@selector(format))];\n    [coder encodeObject:@(self.writeOptions) forKey:NSStringFromSelector(@selector(writeOptions))];\n}\n\n#pragma mark - NSCopying\n\n- (instancetype)copyWithZone:(NSZone *)zone {\n    AFPropertyListRequestSerializer *serializer = [super copyWithZone:zone];\n    serializer.format = self.format;\n    serializer.writeOptions = self.writeOptions;\n\n    return serializer;\n}\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/AFNetworking/AFURLResponseSerialization.h",
    "content": "// AFURLResponseSerialization.h\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import <Foundation/Foundation.h>\n#import <CoreGraphics/CoreGraphics.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n The `AFURLResponseSerialization` protocol is adopted by an object that decodes data into a more useful object representation, according to details in the server response. Response serializers may additionally perform validation on the incoming response and data.\n\n For example, a JSON response serializer may check for an acceptable status code (`2XX` range) and content type (`application/json`), decoding a valid JSON response into an object.\n */\n@protocol AFURLResponseSerialization <NSObject, NSSecureCoding, NSCopying>\n\n/**\n The response object decoded from the data associated with a specified response.\n\n @param response The response to be processed.\n @param data The response data to be decoded.\n @param error The error that occurred while attempting to decode the response data.\n\n @return The object decoded from the specified response data.\n */\n- (nullable id)responseObjectForResponse:(nullable NSURLResponse *)response\n                           data:(nullable NSData *)data\n                          error:(NSError * _Nullable __autoreleasing *)error NS_SWIFT_NOTHROW;\n\n@end\n\n#pragma mark -\n\n/**\n `AFHTTPResponseSerializer` conforms to the `AFURLRequestSerialization` & `AFURLResponseSerialization` protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation.\n\n Any request or response serializer dealing with HTTP is encouraged to subclass `AFHTTPResponseSerializer` in order to ensure consistent default behavior.\n */\n@interface AFHTTPResponseSerializer : NSObject <AFURLResponseSerialization>\n\n- (instancetype)init;\n\n/**\n The string encoding used to serialize data received from the server, when no string encoding is specified by the response. `NSUTF8StringEncoding` by default.\n */\n@property (nonatomic, assign) NSStringEncoding stringEncoding;\n\n/**\n Creates and returns a serializer with default configuration.\n */\n+ (instancetype)serializer;\n\n///-----------------------------------------\n/// @name Configuring Response Serialization\n///-----------------------------------------\n\n/**\n The acceptable HTTP status codes for responses. When non-`nil`, responses with status codes not contained by the set will result in an error during validation.\n\n See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html\n */\n@property (nonatomic, copy, nullable) NSIndexSet *acceptableStatusCodes;\n\n/**\n The acceptable MIME types for responses. When non-`nil`, responses with a `Content-Type` with MIME types that do not intersect with the set will result in an error during validation.\n */\n@property (nonatomic, copy, nullable) NSSet <NSString *> *acceptableContentTypes;\n\n/**\n Validates the specified response and data.\n\n In its base implementation, this method checks for an acceptable status code and content type. Subclasses may wish to add other domain-specific checks.\n\n @param response The response to be validated.\n @param data The data associated with the response.\n @param error The error that occurred while attempting to validate the response.\n\n @return `YES` if the response is valid, otherwise `NO`.\n */\n- (BOOL)validateResponse:(nullable NSHTTPURLResponse *)response\n                    data:(nullable NSData *)data\n                   error:(NSError * _Nullable __autoreleasing *)error;\n\n@end\n\n#pragma mark -\n\n\n/**\n `AFJSONResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes JSON responses.\n\n By default, `AFJSONResponseSerializer` accepts the following MIME types, which includes the official standard, `application/json`, as well as other commonly-used types:\n\n - `application/json`\n - `text/json`\n - `text/javascript`\n */\n@interface AFJSONResponseSerializer : AFHTTPResponseSerializer\n\n- (instancetype)init;\n\n/**\n Options for reading the response JSON data and creating the Foundation objects. For possible values, see the `NSJSONSerialization` documentation section \"NSJSONReadingOptions\". `0` by default.\n */\n@property (nonatomic, assign) NSJSONReadingOptions readingOptions;\n\n/**\n Whether to remove keys with `NSNull` values from response JSON. Defaults to `NO`.\n */\n@property (nonatomic, assign) BOOL removesKeysWithNullValues;\n\n/**\n Creates and returns a JSON serializer with specified reading and writing options.\n\n @param readingOptions The specified JSON reading options.\n */\n+ (instancetype)serializerWithReadingOptions:(NSJSONReadingOptions)readingOptions;\n\n@end\n\n#pragma mark -\n\n/**\n `AFXMLParserResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes XML responses as an `NSXMLParser` objects.\n\n By default, `AFXMLParserResponseSerializer` accepts the following MIME types, which includes the official standard, `application/xml`, as well as other commonly-used types:\n\n - `application/xml`\n - `text/xml`\n */\n@interface AFXMLParserResponseSerializer : AFHTTPResponseSerializer\n\n@end\n\n#pragma mark -\n\n#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED\n\n/**\n `AFXMLDocumentResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes XML responses as an `NSXMLDocument` objects.\n\n By default, `AFXMLDocumentResponseSerializer` accepts the following MIME types, which includes the official standard, `application/xml`, as well as other commonly-used types:\n\n - `application/xml`\n - `text/xml`\n */\n@interface AFXMLDocumentResponseSerializer : AFHTTPResponseSerializer\n\n- (instancetype)init;\n\n/**\n Input and output options specifically intended for `NSXMLDocument` objects. For possible values, see the `NSJSONSerialization` documentation section \"NSJSONReadingOptions\". `0` by default.\n */\n@property (nonatomic, assign) NSUInteger options;\n\n/**\n Creates and returns an XML document serializer with the specified options.\n\n @param mask The XML document options.\n */\n+ (instancetype)serializerWithXMLDocumentOptions:(NSUInteger)mask;\n\n@end\n\n#endif\n\n#pragma mark -\n\n/**\n `AFPropertyListResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes XML responses as an `NSXMLDocument` objects.\n\n By default, `AFPropertyListResponseSerializer` accepts the following MIME types:\n\n - `application/x-plist`\n */\n@interface AFPropertyListResponseSerializer : AFHTTPResponseSerializer\n\n- (instancetype)init;\n\n/**\n The property list format. Possible values are described in \"NSPropertyListFormat\".\n */\n@property (nonatomic, assign) NSPropertyListFormat format;\n\n/**\n The property list reading options. Possible values are described in \"NSPropertyListMutabilityOptions.\"\n */\n@property (nonatomic, assign) NSPropertyListReadOptions readOptions;\n\n/**\n Creates and returns a property list serializer with a specified format, read options, and write options.\n\n @param format The property list format.\n @param readOptions The property list reading options.\n */\n+ (instancetype)serializerWithFormat:(NSPropertyListFormat)format\n                         readOptions:(NSPropertyListReadOptions)readOptions;\n\n@end\n\n#pragma mark -\n\n/**\n `AFImageResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes image responses.\n\n By default, `AFImageResponseSerializer` accepts the following MIME types, which correspond to the image formats supported by UIImage or NSImage:\n\n - `image/tiff`\n - `image/jpeg`\n - `image/gif`\n - `image/png`\n - `image/ico`\n - `image/x-icon`\n - `image/bmp`\n - `image/x-bmp`\n - `image/x-xbitmap`\n - `image/x-win-bitmap`\n */\n@interface AFImageResponseSerializer : AFHTTPResponseSerializer\n\n#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH\n/**\n The scale factor used when interpreting the image data to construct `responseImage`. Specifying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the size property. This is set to the value of scale of the main screen by default, which automatically scales images for retina displays, for instance.\n */\n@property (nonatomic, assign) CGFloat imageScale;\n\n/**\n Whether to automatically inflate response image data for compressed formats (such as PNG or JPEG). Enabling this can significantly improve drawing performance on iOS when used with `setCompletionBlockWithSuccess:failure:`, as it allows a bitmap representation to be constructed in the background rather than on the main thread. `YES` by default.\n */\n@property (nonatomic, assign) BOOL automaticallyInflatesResponseImage;\n#endif\n\n@end\n\n#pragma mark -\n\n/**\n `AFCompoundSerializer` is a subclass of `AFHTTPResponseSerializer` that delegates the response serialization to the first `AFHTTPResponseSerializer` object that returns an object for `responseObjectForResponse:data:error:`, falling back on the default behavior of `AFHTTPResponseSerializer`. This is useful for supporting multiple potential types and structures of server responses with a single serializer.\n */\n@interface AFCompoundResponseSerializer : AFHTTPResponseSerializer\n\n/**\n The component response serializers.\n */\n@property (readonly, nonatomic, copy) NSArray <id<AFURLResponseSerialization>> *responseSerializers;\n\n/**\n Creates and returns a compound serializer comprised of the specified response serializers.\n\n @warning Each response serializer specified must be a subclass of `AFHTTPResponseSerializer`, and response to `-validateResponse:data:error:`.\n */\n+ (instancetype)compoundSerializerWithResponseSerializers:(NSArray <id<AFURLResponseSerialization>> *)responseSerializers;\n\n@end\n\n///----------------\n/// @name Constants\n///----------------\n\n/**\n ## Error Domains\n\n The following error domain is predefined.\n\n - `NSString * const AFURLResponseSerializationErrorDomain`\n\n ### Constants\n\n `AFURLResponseSerializationErrorDomain`\n AFURLResponseSerializer errors. Error codes for `AFURLResponseSerializationErrorDomain` correspond to codes in `NSURLErrorDomain`.\n */\nFOUNDATION_EXPORT NSString * const AFURLResponseSerializationErrorDomain;\n\n/**\n ## User info dictionary keys\n\n These keys may exist in the user info dictionary, in addition to those defined for NSError.\n\n - `NSString * const AFNetworkingOperationFailingURLResponseErrorKey`\n - `NSString * const AFNetworkingOperationFailingURLResponseDataErrorKey`\n\n ### Constants\n\n `AFNetworkingOperationFailingURLResponseErrorKey`\n The corresponding value is an `NSURLResponse` containing the response of the operation associated with an error. This key is only present in the `AFURLResponseSerializationErrorDomain`.\n\n `AFNetworkingOperationFailingURLResponseDataErrorKey`\n The corresponding value is an `NSData` containing the original data of the operation associated with an error. This key is only present in the `AFURLResponseSerializationErrorDomain`.\n */\nFOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLResponseErrorKey;\n\nFOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLResponseDataErrorKey;\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/AFNetworking/AFURLResponseSerialization.m",
    "content": "// AFURLResponseSerialization.m\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import \"AFURLResponseSerialization.h\"\n\n#import <TargetConditionals.h>\n\n#if TARGET_OS_IOS\n#import <UIKit/UIKit.h>\n#elif TARGET_OS_WATCH\n#import <WatchKit/WatchKit.h>\n#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)\n#import <Cocoa/Cocoa.h>\n#endif\n\nNSString * const AFURLResponseSerializationErrorDomain = @\"com.alamofire.error.serialization.response\";\nNSString * const AFNetworkingOperationFailingURLResponseErrorKey = @\"com.alamofire.serialization.response.error.response\";\nNSString * const AFNetworkingOperationFailingURLResponseDataErrorKey = @\"com.alamofire.serialization.response.error.data\";\n\nstatic NSError * AFErrorWithUnderlyingError(NSError *error, NSError *underlyingError) {\n    if (!error) {\n        return underlyingError;\n    }\n\n    if (!underlyingError || error.userInfo[NSUnderlyingErrorKey]) {\n        return error;\n    }\n\n    NSMutableDictionary *mutableUserInfo = [error.userInfo mutableCopy];\n    mutableUserInfo[NSUnderlyingErrorKey] = underlyingError;\n\n    return [[NSError alloc] initWithDomain:error.domain code:error.code userInfo:mutableUserInfo];\n}\n\nstatic BOOL AFErrorOrUnderlyingErrorHasCodeInDomain(NSError *error, NSInteger code, NSString *domain) {\n    if ([error.domain isEqualToString:domain] && error.code == code) {\n        return YES;\n    } else if (error.userInfo[NSUnderlyingErrorKey]) {\n        return AFErrorOrUnderlyingErrorHasCodeInDomain(error.userInfo[NSUnderlyingErrorKey], code, domain);\n    }\n\n    return NO;\n}\n\nstatic id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingOptions readingOptions) {\n    if ([JSONObject isKindOfClass:[NSArray class]]) {\n        NSMutableArray *mutableArray = [NSMutableArray arrayWithCapacity:[(NSArray *)JSONObject count]];\n        for (id value in (NSArray *)JSONObject) {\n            [mutableArray addObject:AFJSONObjectByRemovingKeysWithNullValues(value, readingOptions)];\n        }\n\n        return (readingOptions & NSJSONReadingMutableContainers) ? mutableArray : [NSArray arrayWithArray:mutableArray];\n    } else if ([JSONObject isKindOfClass:[NSDictionary class]]) {\n        NSMutableDictionary *mutableDictionary = [NSMutableDictionary dictionaryWithDictionary:JSONObject];\n        for (id <NSCopying> key in [(NSDictionary *)JSONObject allKeys]) {\n            id value = (NSDictionary *)JSONObject[key];\n            if (!value || [value isEqual:[NSNull null]]) {\n                [mutableDictionary removeObjectForKey:key];\n            } else if ([value isKindOfClass:[NSArray class]] || [value isKindOfClass:[NSDictionary class]]) {\n                mutableDictionary[key] = AFJSONObjectByRemovingKeysWithNullValues(value, readingOptions);\n            }\n        }\n\n        return (readingOptions & NSJSONReadingMutableContainers) ? mutableDictionary : [NSDictionary dictionaryWithDictionary:mutableDictionary];\n    }\n\n    return JSONObject;\n}\n\n@implementation AFHTTPResponseSerializer\n\n+ (instancetype)serializer {\n    return [[self alloc] init];\n}\n\n- (instancetype)init {\n    self = [super init];\n    if (!self) {\n        return nil;\n    }\n\n    self.stringEncoding = NSUTF8StringEncoding;\n\n    self.acceptableStatusCodes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(200, 100)];\n    self.acceptableContentTypes = nil;\n\n    return self;\n}\n\n#pragma mark -\n\n- (BOOL)validateResponse:(NSHTTPURLResponse *)response\n                    data:(NSData *)data\n                   error:(NSError * __autoreleasing *)error\n{\n    BOOL responseIsValid = YES;\n    NSError *validationError = nil;\n\n    if (response && [response isKindOfClass:[NSHTTPURLResponse class]]) {\n        if (self.acceptableContentTypes && ![self.acceptableContentTypes containsObject:[response MIMEType]] &&\n            !([response MIMEType] == nil && [data length] == 0)) {\n\n            if ([data length] > 0 && [response URL]) {\n                NSMutableDictionary *mutableUserInfo = [@{\n                                                          NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedStringFromTable(@\"Request failed: unacceptable content-type: %@\", @\"AFNetworking\", nil), [response MIMEType]],\n                                                          NSURLErrorFailingURLErrorKey:[response URL],\n                                                          AFNetworkingOperationFailingURLResponseErrorKey: response,\n                                                        } mutableCopy];\n                if (data) {\n                    mutableUserInfo[AFNetworkingOperationFailingURLResponseDataErrorKey] = data;\n                }\n\n                validationError = AFErrorWithUnderlyingError([NSError errorWithDomain:AFURLResponseSerializationErrorDomain code:NSURLErrorCannotDecodeContentData userInfo:mutableUserInfo], validationError);\n            }\n\n            responseIsValid = NO;\n        }\n\n        if (self.acceptableStatusCodes && ![self.acceptableStatusCodes containsIndex:(NSUInteger)response.statusCode] && [response URL]) {\n            NSMutableDictionary *mutableUserInfo = [@{\n                                               NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedStringFromTable(@\"Request failed: %@ (%ld)\", @\"AFNetworking\", nil), [NSHTTPURLResponse localizedStringForStatusCode:response.statusCode], (long)response.statusCode],\n                                               NSURLErrorFailingURLErrorKey:[response URL],\n                                               AFNetworkingOperationFailingURLResponseErrorKey: response,\n                                       } mutableCopy];\n\n            if (data) {\n                mutableUserInfo[AFNetworkingOperationFailingURLResponseDataErrorKey] = data;\n            }\n\n            validationError = AFErrorWithUnderlyingError([NSError errorWithDomain:AFURLResponseSerializationErrorDomain code:NSURLErrorBadServerResponse userInfo:mutableUserInfo], validationError);\n\n            responseIsValid = NO;\n        }\n    }\n\n    if (error && !responseIsValid) {\n        *error = validationError;\n    }\n\n    return responseIsValid;\n}\n\n#pragma mark - AFURLResponseSerialization\n\n- (id)responseObjectForResponse:(NSURLResponse *)response\n                           data:(NSData *)data\n                          error:(NSError *__autoreleasing *)error\n{\n    [self validateResponse:(NSHTTPURLResponse *)response data:data error:error];\n\n    return data;\n}\n\n#pragma mark - NSSecureCoding\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n- (instancetype)initWithCoder:(NSCoder *)decoder {\n    self = [self init];\n    if (!self) {\n        return nil;\n    }\n\n    self.acceptableStatusCodes = [decoder decodeObjectOfClass:[NSIndexSet class] forKey:NSStringFromSelector(@selector(acceptableStatusCodes))];\n    self.acceptableContentTypes = [decoder decodeObjectOfClass:[NSIndexSet class] forKey:NSStringFromSelector(@selector(acceptableContentTypes))];\n\n    return self;\n}\n\n- (void)encodeWithCoder:(NSCoder *)coder {\n    [coder encodeObject:self.acceptableStatusCodes forKey:NSStringFromSelector(@selector(acceptableStatusCodes))];\n    [coder encodeObject:self.acceptableContentTypes forKey:NSStringFromSelector(@selector(acceptableContentTypes))];\n}\n\n#pragma mark - NSCopying\n\n- (instancetype)copyWithZone:(NSZone *)zone {\n    AFHTTPResponseSerializer *serializer = [[[self class] allocWithZone:zone] init];\n    serializer.acceptableStatusCodes = [self.acceptableStatusCodes copyWithZone:zone];\n    serializer.acceptableContentTypes = [self.acceptableContentTypes copyWithZone:zone];\n\n    return serializer;\n}\n\n@end\n\n#pragma mark -\n\n@implementation AFJSONResponseSerializer\n\n+ (instancetype)serializer {\n    return [self serializerWithReadingOptions:(NSJSONReadingOptions)0];\n}\n\n+ (instancetype)serializerWithReadingOptions:(NSJSONReadingOptions)readingOptions {\n    AFJSONResponseSerializer *serializer = [[self alloc] init];\n    serializer.readingOptions = readingOptions;\n\n    return serializer;\n}\n\n- (instancetype)init {\n    self = [super init];\n    if (!self) {\n        return nil;\n    }\n\n    self.acceptableContentTypes = [NSSet setWithObjects:@\"application/json\", @\"text/json\", @\"text/javascript\", nil];\n\n    return self;\n}\n\n#pragma mark - AFURLResponseSerialization\n\n- (id)responseObjectForResponse:(NSURLResponse *)response\n                           data:(NSData *)data\n                          error:(NSError *__autoreleasing *)error\n{\n    if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) {\n        if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) {\n            return nil;\n        }\n    }\n\n    id responseObject = nil;\n    NSError *serializationError = nil;\n    // Workaround for behavior of Rails to return a single space for `head :ok` (a workaround for a bug in Safari), which is not interpreted as valid input by NSJSONSerialization.\n    // See https://github.com/rails/rails/issues/1742\n    BOOL isSpace = [data isEqualToData:[NSData dataWithBytes:\" \" length:1]];\n    if (data.length > 0 && !isSpace) {\n        responseObject = [NSJSONSerialization JSONObjectWithData:data options:self.readingOptions error:&serializationError];\n    } else {\n        return nil;\n    }\n\n    if (self.removesKeysWithNullValues && responseObject) {\n        responseObject = AFJSONObjectByRemovingKeysWithNullValues(responseObject, self.readingOptions);\n    }\n\n    if (error) {\n        *error = AFErrorWithUnderlyingError(serializationError, *error);\n    }\n\n    return responseObject;\n}\n\n#pragma mark - NSSecureCoding\n\n- (instancetype)initWithCoder:(NSCoder *)decoder {\n    self = [super initWithCoder:decoder];\n    if (!self) {\n        return nil;\n    }\n\n    self.readingOptions = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(readingOptions))] unsignedIntegerValue];\n    self.removesKeysWithNullValues = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(removesKeysWithNullValues))] boolValue];\n\n    return self;\n}\n\n- (void)encodeWithCoder:(NSCoder *)coder {\n    [super encodeWithCoder:coder];\n\n    [coder encodeObject:@(self.readingOptions) forKey:NSStringFromSelector(@selector(readingOptions))];\n    [coder encodeObject:@(self.removesKeysWithNullValues) forKey:NSStringFromSelector(@selector(removesKeysWithNullValues))];\n}\n\n#pragma mark - NSCopying\n\n- (instancetype)copyWithZone:(NSZone *)zone {\n    AFJSONResponseSerializer *serializer = [[[self class] allocWithZone:zone] init];\n    serializer.readingOptions = self.readingOptions;\n    serializer.removesKeysWithNullValues = self.removesKeysWithNullValues;\n\n    return serializer;\n}\n\n@end\n\n#pragma mark -\n\n@implementation AFXMLParserResponseSerializer\n\n+ (instancetype)serializer {\n    AFXMLParserResponseSerializer *serializer = [[self alloc] init];\n\n    return serializer;\n}\n\n- (instancetype)init {\n    self = [super init];\n    if (!self) {\n        return nil;\n    }\n\n    self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@\"application/xml\", @\"text/xml\", nil];\n\n    return self;\n}\n\n#pragma mark - AFURLResponseSerialization\n\n- (id)responseObjectForResponse:(NSHTTPURLResponse *)response\n                           data:(NSData *)data\n                          error:(NSError *__autoreleasing *)error\n{\n    if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) {\n        if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) {\n            return nil;\n        }\n    }\n\n    return [[NSXMLParser alloc] initWithData:data];\n}\n\n@end\n\n#pragma mark -\n\n#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED\n\n@implementation AFXMLDocumentResponseSerializer\n\n+ (instancetype)serializer {\n    return [self serializerWithXMLDocumentOptions:0];\n}\n\n+ (instancetype)serializerWithXMLDocumentOptions:(NSUInteger)mask {\n    AFXMLDocumentResponseSerializer *serializer = [[self alloc] init];\n    serializer.options = mask;\n\n    return serializer;\n}\n\n- (instancetype)init {\n    self = [super init];\n    if (!self) {\n        return nil;\n    }\n\n    self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@\"application/xml\", @\"text/xml\", nil];\n\n    return self;\n}\n\n#pragma mark - AFURLResponseSerialization\n\n- (id)responseObjectForResponse:(NSURLResponse *)response\n                           data:(NSData *)data\n                          error:(NSError *__autoreleasing *)error\n{\n    if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) {\n        if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) {\n            return nil;\n        }\n    }\n\n    NSError *serializationError = nil;\n    NSXMLDocument *document = [[NSXMLDocument alloc] initWithData:data options:self.options error:&serializationError];\n\n    if (error) {\n        *error = AFErrorWithUnderlyingError(serializationError, *error);\n    }\n\n    return document;\n}\n\n#pragma mark - NSSecureCoding\n\n- (instancetype)initWithCoder:(NSCoder *)decoder {\n    self = [super initWithCoder:decoder];\n    if (!self) {\n        return nil;\n    }\n\n    self.options = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(options))] unsignedIntegerValue];\n\n    return self;\n}\n\n- (void)encodeWithCoder:(NSCoder *)coder {\n    [super encodeWithCoder:coder];\n\n    [coder encodeObject:@(self.options) forKey:NSStringFromSelector(@selector(options))];\n}\n\n#pragma mark - NSCopying\n\n- (instancetype)copyWithZone:(NSZone *)zone {\n    AFXMLDocumentResponseSerializer *serializer = [[[self class] allocWithZone:zone] init];\n    serializer.options = self.options;\n\n    return serializer;\n}\n\n@end\n\n#endif\n\n#pragma mark -\n\n@implementation AFPropertyListResponseSerializer\n\n+ (instancetype)serializer {\n    return [self serializerWithFormat:NSPropertyListXMLFormat_v1_0 readOptions:0];\n}\n\n+ (instancetype)serializerWithFormat:(NSPropertyListFormat)format\n                         readOptions:(NSPropertyListReadOptions)readOptions\n{\n    AFPropertyListResponseSerializer *serializer = [[self alloc] init];\n    serializer.format = format;\n    serializer.readOptions = readOptions;\n\n    return serializer;\n}\n\n- (instancetype)init {\n    self = [super init];\n    if (!self) {\n        return nil;\n    }\n\n    self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@\"application/x-plist\", nil];\n\n    return self;\n}\n\n#pragma mark - AFURLResponseSerialization\n\n- (id)responseObjectForResponse:(NSURLResponse *)response\n                           data:(NSData *)data\n                          error:(NSError *__autoreleasing *)error\n{\n    if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) {\n        if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) {\n            return nil;\n        }\n    }\n\n    id responseObject;\n    NSError *serializationError = nil;\n\n    if (data) {\n        responseObject = [NSPropertyListSerialization propertyListWithData:data options:self.readOptions format:NULL error:&serializationError];\n    }\n\n    if (error) {\n        *error = AFErrorWithUnderlyingError(serializationError, *error);\n    }\n\n    return responseObject;\n}\n\n#pragma mark - NSSecureCoding\n\n- (instancetype)initWithCoder:(NSCoder *)decoder {\n    self = [super initWithCoder:decoder];\n    if (!self) {\n        return nil;\n    }\n\n    self.format = (NSPropertyListFormat)[[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(format))] unsignedIntegerValue];\n    self.readOptions = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(readOptions))] unsignedIntegerValue];\n\n    return self;\n}\n\n- (void)encodeWithCoder:(NSCoder *)coder {\n    [super encodeWithCoder:coder];\n\n    [coder encodeObject:@(self.format) forKey:NSStringFromSelector(@selector(format))];\n    [coder encodeObject:@(self.readOptions) forKey:NSStringFromSelector(@selector(readOptions))];\n}\n\n#pragma mark - NSCopying\n\n- (instancetype)copyWithZone:(NSZone *)zone {\n    AFPropertyListResponseSerializer *serializer = [[[self class] allocWithZone:zone] init];\n    serializer.format = self.format;\n    serializer.readOptions = self.readOptions;\n\n    return serializer;\n}\n\n@end\n\n#pragma mark -\n\n#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH\n#import <CoreGraphics/CoreGraphics.h>\n#import <UIKit/UIKit.h>\n\n@interface UIImage (AFNetworkingSafeImageLoading)\n+ (UIImage *)af_safeImageWithData:(NSData *)data;\n@end\n\nstatic NSLock* imageLock = nil;\n\n@implementation UIImage (AFNetworkingSafeImageLoading)\n\n+ (UIImage *)af_safeImageWithData:(NSData *)data {\n    UIImage* image = nil;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        imageLock = [[NSLock alloc] init];\n    });\n    \n    [imageLock lock];\n    image = [UIImage imageWithData:data];\n    [imageLock unlock];\n    return image;\n}\n\n@end\n\nstatic UIImage * AFImageWithDataAtScale(NSData *data, CGFloat scale) {\n    UIImage *image = [UIImage af_safeImageWithData:data];\n    if (image.images) {\n        return image;\n    }\n    \n    return [[UIImage alloc] initWithCGImage:[image CGImage] scale:scale orientation:image.imageOrientation];\n}\n\nstatic UIImage * AFInflatedImageFromResponseWithDataAtScale(NSHTTPURLResponse *response, NSData *data, CGFloat scale) {\n    if (!data || [data length] == 0) {\n        return nil;\n    }\n\n    CGImageRef imageRef = NULL;\n    CGDataProviderRef dataProvider = CGDataProviderCreateWithCFData((__bridge CFDataRef)data);\n\n    if ([response.MIMEType isEqualToString:@\"image/png\"]) {\n        imageRef = CGImageCreateWithPNGDataProvider(dataProvider,  NULL, true, kCGRenderingIntentDefault);\n    } else if ([response.MIMEType isEqualToString:@\"image/jpeg\"]) {\n        imageRef = CGImageCreateWithJPEGDataProvider(dataProvider, NULL, true, kCGRenderingIntentDefault);\n\n        if (imageRef) {\n            CGColorSpaceRef imageColorSpace = CGImageGetColorSpace(imageRef);\n            CGColorSpaceModel imageColorSpaceModel = CGColorSpaceGetModel(imageColorSpace);\n\n            // CGImageCreateWithJPEGDataProvider does not properly handle CMKY, so fall back to AFImageWithDataAtScale\n            if (imageColorSpaceModel == kCGColorSpaceModelCMYK) {\n                CGImageRelease(imageRef);\n                imageRef = NULL;\n            }\n        }\n    }\n\n    CGDataProviderRelease(dataProvider);\n\n    UIImage *image = AFImageWithDataAtScale(data, scale);\n    if (!imageRef) {\n        if (image.images || !image) {\n            return image;\n        }\n\n        imageRef = CGImageCreateCopy([image CGImage]);\n        if (!imageRef) {\n            return nil;\n        }\n    }\n\n    size_t width = CGImageGetWidth(imageRef);\n    size_t height = CGImageGetHeight(imageRef);\n    size_t bitsPerComponent = CGImageGetBitsPerComponent(imageRef);\n\n    if (width * height > 1024 * 1024 || bitsPerComponent > 8) {\n        CGImageRelease(imageRef);\n\n        return image;\n    }\n\n    // CGImageGetBytesPerRow() calculates incorrectly in iOS 5.0, so defer to CGBitmapContextCreate\n    size_t bytesPerRow = 0;\n    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();\n    CGColorSpaceModel colorSpaceModel = CGColorSpaceGetModel(colorSpace);\n    CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef);\n\n    if (colorSpaceModel == kCGColorSpaceModelRGB) {\n        uint32_t alpha = (bitmapInfo & kCGBitmapAlphaInfoMask);\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wassign-enum\"\n        if (alpha == kCGImageAlphaNone) {\n            bitmapInfo &= ~kCGBitmapAlphaInfoMask;\n            bitmapInfo |= kCGImageAlphaNoneSkipFirst;\n        } else if (!(alpha == kCGImageAlphaNoneSkipFirst || alpha == kCGImageAlphaNoneSkipLast)) {\n            bitmapInfo &= ~kCGBitmapAlphaInfoMask;\n            bitmapInfo |= kCGImageAlphaPremultipliedFirst;\n        }\n#pragma clang diagnostic pop\n    }\n\n    CGContextRef context = CGBitmapContextCreate(NULL, width, height, bitsPerComponent, bytesPerRow, colorSpace, bitmapInfo);\n\n    CGColorSpaceRelease(colorSpace);\n\n    if (!context) {\n        CGImageRelease(imageRef);\n\n        return image;\n    }\n\n    CGContextDrawImage(context, CGRectMake(0.0f, 0.0f, width, height), imageRef);\n    CGImageRef inflatedImageRef = CGBitmapContextCreateImage(context);\n\n    CGContextRelease(context);\n\n    UIImage *inflatedImage = [[UIImage alloc] initWithCGImage:inflatedImageRef scale:scale orientation:image.imageOrientation];\n\n    CGImageRelease(inflatedImageRef);\n    CGImageRelease(imageRef);\n\n    return inflatedImage;\n}\n#endif\n\n\n@implementation AFImageResponseSerializer\n\n- (instancetype)init {\n    self = [super init];\n    if (!self) {\n        return nil;\n    }\n\n    self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@\"image/tiff\", @\"image/jpeg\", @\"image/gif\", @\"image/png\", @\"image/ico\", @\"image/x-icon\", @\"image/bmp\", @\"image/x-bmp\", @\"image/x-xbitmap\", @\"image/x-win-bitmap\", nil];\n\n#if TARGET_OS_IOS || TARGET_OS_TV\n    self.imageScale = [[UIScreen mainScreen] scale];\n    self.automaticallyInflatesResponseImage = YES;\n#elif TARGET_OS_WATCH\n    self.imageScale = [[WKInterfaceDevice currentDevice] screenScale];\n    self.automaticallyInflatesResponseImage = YES;\n#endif\n\n    return self;\n}\n\n#pragma mark - AFURLResponseSerializer\n\n- (id)responseObjectForResponse:(NSURLResponse *)response\n                           data:(NSData *)data\n                          error:(NSError *__autoreleasing *)error\n{\n    if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) {\n        if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) {\n            return nil;\n        }\n    }\n\n#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH\n    if (self.automaticallyInflatesResponseImage) {\n        return AFInflatedImageFromResponseWithDataAtScale((NSHTTPURLResponse *)response, data, self.imageScale);\n    } else {\n        return AFImageWithDataAtScale(data, self.imageScale);\n    }\n#else\n    // Ensure that the image is set to it's correct pixel width and height\n    NSBitmapImageRep *bitimage = [[NSBitmapImageRep alloc] initWithData:data];\n    NSImage *image = [[NSImage alloc] initWithSize:NSMakeSize([bitimage pixelsWide], [bitimage pixelsHigh])];\n    [image addRepresentation:bitimage];\n\n    return image;\n#endif\n\n    return nil;\n}\n\n#pragma mark - NSSecureCoding\n\n- (instancetype)initWithCoder:(NSCoder *)decoder {\n    self = [super initWithCoder:decoder];\n    if (!self) {\n        return nil;\n    }\n\n#if TARGET_OS_IOS  || TARGET_OS_TV || TARGET_OS_WATCH\n    NSNumber *imageScale = [decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(imageScale))];\n#if CGFLOAT_IS_DOUBLE\n    self.imageScale = [imageScale doubleValue];\n#else\n    self.imageScale = [imageScale floatValue];\n#endif\n\n    self.automaticallyInflatesResponseImage = [decoder decodeBoolForKey:NSStringFromSelector(@selector(automaticallyInflatesResponseImage))];\n#endif\n\n    return self;\n}\n\n- (void)encodeWithCoder:(NSCoder *)coder {\n    [super encodeWithCoder:coder];\n\n#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH\n    [coder encodeObject:@(self.imageScale) forKey:NSStringFromSelector(@selector(imageScale))];\n    [coder encodeBool:self.automaticallyInflatesResponseImage forKey:NSStringFromSelector(@selector(automaticallyInflatesResponseImage))];\n#endif\n}\n\n#pragma mark - NSCopying\n\n- (instancetype)copyWithZone:(NSZone *)zone {\n    AFImageResponseSerializer *serializer = [[[self class] allocWithZone:zone] init];\n\n#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH\n    serializer.imageScale = self.imageScale;\n    serializer.automaticallyInflatesResponseImage = self.automaticallyInflatesResponseImage;\n#endif\n\n    return serializer;\n}\n\n@end\n\n#pragma mark -\n\n@interface AFCompoundResponseSerializer ()\n@property (readwrite, nonatomic, copy) NSArray *responseSerializers;\n@end\n\n@implementation AFCompoundResponseSerializer\n\n+ (instancetype)compoundSerializerWithResponseSerializers:(NSArray *)responseSerializers {\n    AFCompoundResponseSerializer *serializer = [[self alloc] init];\n    serializer.responseSerializers = responseSerializers;\n\n    return serializer;\n}\n\n#pragma mark - AFURLResponseSerialization\n\n- (id)responseObjectForResponse:(NSURLResponse *)response\n                           data:(NSData *)data\n                          error:(NSError *__autoreleasing *)error\n{\n    for (id <AFURLResponseSerialization> serializer in self.responseSerializers) {\n        if (![serializer isKindOfClass:[AFHTTPResponseSerializer class]]) {\n            continue;\n        }\n\n        NSError *serializerError = nil;\n        id responseObject = [serializer responseObjectForResponse:response data:data error:&serializerError];\n        if (responseObject) {\n            if (error) {\n                *error = AFErrorWithUnderlyingError(serializerError, *error);\n            }\n\n            return responseObject;\n        }\n    }\n\n    return [super responseObjectForResponse:response data:data error:error];\n}\n\n#pragma mark - NSSecureCoding\n\n- (instancetype)initWithCoder:(NSCoder *)decoder {\n    self = [super initWithCoder:decoder];\n    if (!self) {\n        return nil;\n    }\n\n    self.responseSerializers = [decoder decodeObjectOfClass:[NSArray class] forKey:NSStringFromSelector(@selector(responseSerializers))];\n\n    return self;\n}\n\n- (void)encodeWithCoder:(NSCoder *)coder {\n    [super encodeWithCoder:coder];\n\n    [coder encodeObject:self.responseSerializers forKey:NSStringFromSelector(@selector(responseSerializers))];\n}\n\n#pragma mark - NSCopying\n\n- (instancetype)copyWithZone:(NSZone *)zone {\n    AFCompoundResponseSerializer *serializer = [[[self class] allocWithZone:zone] init];\n    serializer.responseSerializers = self.responseSerializers;\n\n    return serializer;\n}\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/AFNetworking/AFURLSessionManager.h",
    "content": "// AFURLSessionManager.h\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n\n#import <Foundation/Foundation.h>\n\n#import \"AFURLResponseSerialization.h\"\n#import \"AFURLRequestSerialization.h\"\n#import \"AFSecurityPolicy.h\"\n#if !TARGET_OS_WATCH\n#import \"AFNetworkReachabilityManager.h\"\n#endif\n\n/**\n `AFURLSessionManager` creates and manages an `NSURLSession` object based on a specified `NSURLSessionConfiguration` object, which conforms to `<NSURLSessionTaskDelegate>`, `<NSURLSessionDataDelegate>`, `<NSURLSessionDownloadDelegate>`, and `<NSURLSessionDelegate>`.\n\n ## Subclassing Notes\n\n This is the base class for `AFHTTPSessionManager`, which adds functionality specific to making HTTP requests. If you are looking to extend `AFURLSessionManager` specifically for HTTP, consider subclassing `AFHTTPSessionManager` instead.\n\n ## NSURLSession & NSURLSessionTask Delegate Methods\n\n `AFURLSessionManager` implements the following delegate methods:\n\n ### `NSURLSessionDelegate`\n\n - `URLSession:didBecomeInvalidWithError:`\n - `URLSession:didReceiveChallenge:completionHandler:`\n - `URLSessionDidFinishEventsForBackgroundURLSession:`\n\n ### `NSURLSessionTaskDelegate`\n\n - `URLSession:willPerformHTTPRedirection:newRequest:completionHandler:`\n - `URLSession:task:didReceiveChallenge:completionHandler:`\n - `URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:`\n - `URLSession:task:needNewBodyStream:`\n - `URLSession:task:didCompleteWithError:`\n\n ### `NSURLSessionDataDelegate`\n\n - `URLSession:dataTask:didReceiveResponse:completionHandler:`\n - `URLSession:dataTask:didBecomeDownloadTask:`\n - `URLSession:dataTask:didReceiveData:`\n - `URLSession:dataTask:willCacheResponse:completionHandler:`\n\n ### `NSURLSessionDownloadDelegate`\n\n - `URLSession:downloadTask:didFinishDownloadingToURL:`\n - `URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesWritten:totalBytesExpectedToWrite:`\n - `URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:`\n\n If any of these methods are overridden in a subclass, they _must_ call the `super` implementation first.\n\n ## Network Reachability Monitoring\n\n Network reachability status and change monitoring is available through the `reachabilityManager` property. Applications may choose to monitor network reachability conditions in order to prevent or suspend any outbound requests. See `AFNetworkReachabilityManager` for more details.\n\n ## NSCoding Caveats\n\n - Encoded managers do not include any block properties. Be sure to set delegate callback blocks when using `-initWithCoder:` or `NSKeyedUnarchiver`.\n\n ## NSCopying Caveats\n\n - `-copy` and `-copyWithZone:` return a new manager with a new `NSURLSession` created from the configuration of the original.\n - Operation copies do not include any delegate callback blocks, as they often strongly captures a reference to `self`, which would otherwise have the unintuitive side-effect of pointing to the _original_ session manager when copied.\n\n @warning Managers for background sessions must be owned for the duration of their use. This can be accomplished by creating an application-wide or shared singleton instance.\n */\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface AFURLSessionManager : NSObject <NSURLSessionDelegate, NSURLSessionTaskDelegate, NSURLSessionDataDelegate, NSURLSessionDownloadDelegate, NSSecureCoding, NSCopying>\n\n/**\n The managed session.\n */\n@property (readonly, nonatomic, strong) NSURLSession *session;\n\n/**\n The operation queue on which delegate callbacks are run.\n */\n@property (readonly, nonatomic, strong) NSOperationQueue *operationQueue;\n\n/**\n Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to an instance of `AFJSONResponseSerializer`.\n\n @warning `responseSerializer` must not be `nil`.\n */\n@property (nonatomic, strong) id <AFURLResponseSerialization> responseSerializer;\n\n///-------------------------------\n/// @name Managing Security Policy\n///-------------------------------\n\n/**\n The security policy used by created session to evaluate server trust for secure connections. `AFURLSessionManager` uses the `defaultPolicy` unless otherwise specified.\n */\n@property (nonatomic, strong) AFSecurityPolicy *securityPolicy;\n\n#if !TARGET_OS_WATCH\n///--------------------------------------\n/// @name Monitoring Network Reachability\n///--------------------------------------\n\n/**\n The network reachability manager. `AFURLSessionManager` uses the `sharedManager` by default.\n */\n@property (readwrite, nonatomic, strong) AFNetworkReachabilityManager *reachabilityManager;\n#endif\n\n///----------------------------\n/// @name Getting Session Tasks\n///----------------------------\n\n/**\n The data, upload, and download tasks currently run by the managed session.\n */\n@property (readonly, nonatomic, strong) NSArray <NSURLSessionTask *> *tasks;\n\n/**\n The data tasks currently run by the managed session.\n */\n@property (readonly, nonatomic, strong) NSArray <NSURLSessionDataTask *> *dataTasks;\n\n/**\n The upload tasks currently run by the managed session.\n */\n@property (readonly, nonatomic, strong) NSArray <NSURLSessionUploadTask *> *uploadTasks;\n\n/**\n The download tasks currently run by the managed session.\n */\n@property (readonly, nonatomic, strong) NSArray <NSURLSessionDownloadTask *> *downloadTasks;\n\n///-------------------------------\n/// @name Managing Callback Queues\n///-------------------------------\n\n/**\n The dispatch queue for `completionBlock`. If `NULL` (default), the main queue is used.\n */\n@property (nonatomic, strong, nullable) dispatch_queue_t completionQueue;\n\n/**\n The dispatch group for `completionBlock`. If `NULL` (default), a private dispatch group is used.\n */\n@property (nonatomic, strong, nullable) dispatch_group_t completionGroup;\n\n///---------------------------------\n/// @name Working Around System Bugs\n///---------------------------------\n\n/**\n Whether to attempt to retry creation of upload tasks for background sessions when initial call returns `nil`. `NO` by default.\n\n @bug As of iOS 7.0, there is a bug where upload tasks created for background tasks are sometimes `nil`. As a workaround, if this property is `YES`, AFNetworking will follow Apple's recommendation to try creating the task again.\n\n @see https://github.com/AFNetworking/AFNetworking/issues/1675\n */\n@property (nonatomic, assign) BOOL attemptsToRecreateUploadTasksForBackgroundSessions;\n\n///---------------------\n/// @name Initialization\n///---------------------\n\n/**\n Creates and returns a manager for a session created with the specified configuration. This is the designated initializer.\n\n @param configuration The configuration used to create the managed session.\n\n @return A manager for a newly-created session.\n */\n- (instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfiguration *)configuration NS_DESIGNATED_INITIALIZER;\n\n/**\n Invalidates the managed session, optionally canceling pending tasks.\n\n @param cancelPendingTasks Whether or not to cancel pending tasks.\n */\n- (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks;\n\n///-------------------------\n/// @name Running Data Tasks\n///-------------------------\n\n/**\n Creates an `NSURLSessionDataTask` with the specified request.\n\n @param request The HTTP request for the request.\n @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any.\n */\n- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request\n                            completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject,  NSError * _Nullable error))completionHandler;\n\n/**\n Creates an `NSURLSessionDataTask` with the specified request.\n\n @param request The HTTP request for the request.\n @param uploadProgressBlock A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue.\n @param downloadProgressBlock A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue.\n @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any.\n */\n- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request\n                               uploadProgress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock\n                             downloadProgress:(nullable void (^)(NSProgress *downloadProgress))downloadProgressBlock\n                            completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject,  NSError * _Nullable error))completionHandler;\n\n///---------------------------\n/// @name Running Upload Tasks\n///---------------------------\n\n/**\n Creates an `NSURLSessionUploadTask` with the specified request for a local file.\n\n @param request The HTTP request for the request.\n @param fileURL A URL to the local file to be uploaded.\n @param uploadProgressBlock A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue.\n @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any.\n\n @see `attemptsToRecreateUploadTasksForBackgroundSessions`\n */\n- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request\n                                         fromFile:(NSURL *)fileURL\n                                         progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock\n                                completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError  * _Nullable error))completionHandler;\n\n/**\n Creates an `NSURLSessionUploadTask` with the specified request for an HTTP body.\n\n @param request The HTTP request for the request.\n @param bodyData A data object containing the HTTP body to be uploaded.\n @param uploadProgressBlock A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue.\n @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any.\n */\n- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request\n                                         fromData:(nullable NSData *)bodyData\n                                         progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock\n                                completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler;\n\n/**\n Creates an `NSURLSessionUploadTask` with the specified streaming request.\n\n @param request The HTTP request for the request.\n @param uploadProgressBlock A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue.\n @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any.\n */\n- (NSURLSessionUploadTask *)uploadTaskWithStreamedRequest:(NSURLRequest *)request\n                                                 progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock\n                                        completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler;\n\n///-----------------------------\n/// @name Running Download Tasks\n///-----------------------------\n\n/**\n Creates an `NSURLSessionDownloadTask` with the specified request.\n\n @param request The HTTP request for the request.\n @param downloadProgressBlock A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue.\n @param destination A block object to be executed in order to determine the destination of the downloaded file. This block takes two arguments, the target path & the server response, and returns the desired file URL of the resulting download. The temporary file used during the download will be automatically deleted after being moved to the returned URL.\n @param completionHandler A block to be executed when a task finishes. This block has no return value and takes three arguments: the server response, the path of the downloaded file, and the error describing the network or parsing error that occurred, if any.\n\n @warning If using a background `NSURLSessionConfiguration` on iOS, these blocks will be lost when the app is terminated. Background sessions may prefer to use `-setDownloadTaskDidFinishDownloadingBlock:` to specify the URL for saving the downloaded file, rather than the destination block of this method.\n */\n- (NSURLSessionDownloadTask *)downloadTaskWithRequest:(NSURLRequest *)request\n                                             progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgressBlock\n                                          destination:(nullable NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination\n                                    completionHandler:(nullable void (^)(NSURLResponse *response, NSURL * _Nullable filePath, NSError * _Nullable error))completionHandler;\n\n/**\n Creates an `NSURLSessionDownloadTask` with the specified resume data.\n\n @param resumeData The data used to resume downloading.\n @param downloadProgressBlock A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue.\n @param destination A block object to be executed in order to determine the destination of the downloaded file. This block takes two arguments, the target path & the server response, and returns the desired file URL of the resulting download. The temporary file used during the download will be automatically deleted after being moved to the returned URL.\n @param completionHandler A block to be executed when a task finishes. This block has no return value and takes three arguments: the server response, the path of the downloaded file, and the error describing the network or parsing error that occurred, if any.\n */\n- (NSURLSessionDownloadTask *)downloadTaskWithResumeData:(NSData *)resumeData\n                                                progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgressBlock\n                                             destination:(nullable NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination\n                                       completionHandler:(nullable void (^)(NSURLResponse *response, NSURL * _Nullable filePath, NSError * _Nullable error))completionHandler;\n\n///---------------------------------\n/// @name Getting Progress for Tasks\n///---------------------------------\n\n/**\n Returns the upload progress of the specified task.\n\n @param task The session task. Must not be `nil`.\n\n @return An `NSProgress` object reporting the upload progress of a task, or `nil` if the progress is unavailable.\n */\n- (nullable NSProgress *)uploadProgressForTask:(NSURLSessionTask *)task;\n\n/**\n Returns the download progress of the specified task.\n\n @param task The session task. Must not be `nil`.\n\n @return An `NSProgress` object reporting the download progress of a task, or `nil` if the progress is unavailable.\n */\n- (nullable NSProgress *)downloadProgressForTask:(NSURLSessionTask *)task;\n\n///-----------------------------------------\n/// @name Setting Session Delegate Callbacks\n///-----------------------------------------\n\n/**\n Sets a block to be executed when the managed session becomes invalid, as handled by the `NSURLSessionDelegate` method `URLSession:didBecomeInvalidWithError:`.\n\n @param block A block object to be executed when the managed session becomes invalid. The block has no return value, and takes two arguments: the session, and the error related to the cause of invalidation.\n */\n- (void)setSessionDidBecomeInvalidBlock:(nullable void (^)(NSURLSession *session, NSError *error))block;\n\n/**\n Sets a block to be executed when a connection level authentication challenge has occurred, as handled by the `NSURLSessionDelegate` method `URLSession:didReceiveChallenge:completionHandler:`.\n\n @param block A block object to be executed when a connection level authentication challenge has occurred. The block returns the disposition of the authentication challenge, and takes three arguments: the session, the authentication challenge, and a pointer to the credential that should be used to resolve the challenge.\n */\n- (void)setSessionDidReceiveAuthenticationChallengeBlock:(nullable NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * _Nullable __autoreleasing * _Nullable credential))block;\n\n///--------------------------------------\n/// @name Setting Task Delegate Callbacks\n///--------------------------------------\n\n/**\n Sets a block to be executed when a task requires a new request body stream to send to the remote server, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:needNewBodyStream:`.\n\n @param block A block object to be executed when a task requires a new request body stream.\n */\n- (void)setTaskNeedNewBodyStreamBlock:(nullable NSInputStream * (^)(NSURLSession *session, NSURLSessionTask *task))block;\n\n/**\n Sets a block to be executed when an HTTP request is attempting to perform a redirection to a different URL, as handled by the `NSURLSessionTaskDelegate` method `URLSession:willPerformHTTPRedirection:newRequest:completionHandler:`.\n\n @param block A block object to be executed when an HTTP request is attempting to perform a redirection to a different URL. The block returns the request to be made for the redirection, and takes four arguments: the session, the task, the redirection response, and the request corresponding to the redirection response.\n */\n- (void)setTaskWillPerformHTTPRedirectionBlock:(nullable NSURLRequest * (^)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request))block;\n\n/**\n Sets a block to be executed when a session task has received a request specific authentication challenge, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didReceiveChallenge:completionHandler:`.\n\n @param block A block object to be executed when a session task has received a request specific authentication challenge. The block returns the disposition of the authentication challenge, and takes four arguments: the session, the task, the authentication challenge, and a pointer to the credential that should be used to resolve the challenge.\n */\n- (void)setTaskDidReceiveAuthenticationChallengeBlock:(nullable NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, NSURLCredential * _Nullable __autoreleasing * _Nullable credential))block;\n\n/**\n Sets a block to be executed periodically to track upload progress, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:`.\n\n @param block A block object to be called when an undetermined number of bytes have been uploaded to the server. This block has no return value and takes five arguments: the session, the task, the number of bytes written since the last time the upload progress block was called, the total bytes written, and the total bytes expected to be written during the request, as initially determined by the length of the HTTP body. This block may be called multiple times, and will execute on the main thread.\n */\n- (void)setTaskDidSendBodyDataBlock:(nullable void (^)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend))block;\n\n/**\n Sets a block to be executed as the last message related to a specific task, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didCompleteWithError:`.\n\n @param block A block object to be executed when a session task is completed. The block has no return value, and takes three arguments: the session, the task, and any error that occurred in the process of executing the task.\n */\n- (void)setTaskDidCompleteBlock:(nullable void (^)(NSURLSession *session, NSURLSessionTask *task, NSError * _Nullable error))block;\n\n///-------------------------------------------\n/// @name Setting Data Task Delegate Callbacks\n///-------------------------------------------\n\n/**\n Sets a block to be executed when a data task has received a response, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:didReceiveResponse:completionHandler:`.\n\n @param block A block object to be executed when a data task has received a response. The block returns the disposition of the session response, and takes three arguments: the session, the data task, and the received response.\n */\n- (void)setDataTaskDidReceiveResponseBlock:(nullable NSURLSessionResponseDisposition (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLResponse *response))block;\n\n/**\n Sets a block to be executed when a data task has become a download task, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:didBecomeDownloadTask:`.\n\n @param block A block object to be executed when a data task has become a download task. The block has no return value, and takes three arguments: the session, the data task, and the download task it has become.\n */\n- (void)setDataTaskDidBecomeDownloadTaskBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLSessionDownloadTask *downloadTask))block;\n\n/**\n Sets a block to be executed when a data task receives data, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:didReceiveData:`.\n\n @param block A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes three arguments: the session, the data task, and the data received. This block may be called multiple times, and will execute on the session manager operation queue.\n */\n- (void)setDataTaskDidReceiveDataBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSData *data))block;\n\n/**\n Sets a block to be executed to determine the caching behavior of a data task, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:willCacheResponse:completionHandler:`.\n\n @param block A block object to be executed to determine the caching behavior of a data task. The block returns the response to cache, and takes three arguments: the session, the data task, and the proposed cached URL response.\n */\n- (void)setDataTaskWillCacheResponseBlock:(nullable NSCachedURLResponse * (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSCachedURLResponse *proposedResponse))block;\n\n/**\n Sets a block to be executed once all messages enqueued for a session have been delivered, as handled by the `NSURLSessionDataDelegate` method `URLSessionDidFinishEventsForBackgroundURLSession:`.\n\n @param block A block object to be executed once all messages enqueued for a session have been delivered. The block has no return value and takes a single argument: the session.\n */\n- (void)setDidFinishEventsForBackgroundURLSessionBlock:(nullable void (^)(NSURLSession *session))block;\n\n///-----------------------------------------------\n/// @name Setting Download Task Delegate Callbacks\n///-----------------------------------------------\n\n/**\n Sets a block to be executed when a download task has completed a download, as handled by the `NSURLSessionDownloadDelegate` method `URLSession:downloadTask:didFinishDownloadingToURL:`.\n\n @param block A block object to be executed when a download task has completed. The block returns the URL the download should be moved to, and takes three arguments: the session, the download task, and the temporary location of the downloaded file. If the file manager encounters an error while attempting to move the temporary file to the destination, an `AFURLSessionDownloadTaskDidFailToMoveFileNotification` will be posted, with the download task as its object, and the user info of the error.\n */\n- (void)setDownloadTaskDidFinishDownloadingBlock:(nullable NSURL * _Nullable  (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location))block;\n\n/**\n Sets a block to be executed periodically to track download progress, as handled by the `NSURLSessionDownloadDelegate` method `URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesWritten:totalBytesExpectedToWrite:`.\n\n @param block A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes five arguments: the session, the download task, the number of bytes read since the last time the download progress block was called, the total bytes read, and the total bytes expected to be read during the request, as initially determined by the expected content size of the `NSHTTPURLResponse` object. This block may be called multiple times, and will execute on the session manager operation queue.\n */\n- (void)setDownloadTaskDidWriteDataBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite))block;\n\n/**\n Sets a block to be executed when a download task has been resumed, as handled by the `NSURLSessionDownloadDelegate` method `URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:`.\n\n @param block A block object to be executed when a download task has been resumed. The block has no return value and takes four arguments: the session, the download task, the file offset of the resumed download, and the total number of bytes expected to be downloaded.\n */\n- (void)setDownloadTaskDidResumeBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t fileOffset, int64_t expectedTotalBytes))block;\n\n@end\n\n///--------------------\n/// @name Notifications\n///--------------------\n\n/**\n Posted when a task resumes.\n */\nFOUNDATION_EXPORT NSString * const AFNetworkingTaskDidResumeNotification;\n\n/**\n Posted when a task finishes executing. Includes a userInfo dictionary with additional information about the task.\n */\nFOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteNotification;\n\n/**\n Posted when a task suspends its execution.\n */\nFOUNDATION_EXPORT NSString * const AFNetworkingTaskDidSuspendNotification;\n\n/**\n Posted when a session is invalidated.\n */\nFOUNDATION_EXPORT NSString * const AFURLSessionDidInvalidateNotification;\n\n/**\n Posted when a session download task encountered an error when moving the temporary download file to a specified destination.\n */\nFOUNDATION_EXPORT NSString * const AFURLSessionDownloadTaskDidFailToMoveFileNotification;\n\n/**\n The raw response data of the task. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if response data exists for the task.\n */\nFOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteResponseDataKey;\n\n/**\n The serialized response object of the task. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if the response was serialized.\n */\nFOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteSerializedResponseKey;\n\n/**\n The response serializer used to serialize the response. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if the task has an associated response serializer.\n */\nFOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteResponseSerializerKey;\n\n/**\n The file path associated with the download task. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if an the response data has been stored directly to disk.\n */\nFOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteAssetPathKey;\n\n/**\n Any error associated with the task, or the serialization of the response. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if an error exists.\n */\nFOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteErrorKey;\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/AFNetworking/AFURLSessionManager.m",
    "content": "// AFURLSessionManager.m\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import \"AFURLSessionManager.h\"\n#import <objc/runtime.h>\n\n#ifndef NSFoundationVersionNumber_iOS_8_0\n#define NSFoundationVersionNumber_With_Fixed_5871104061079552_bug 1140.11\n#else\n#define NSFoundationVersionNumber_With_Fixed_5871104061079552_bug NSFoundationVersionNumber_iOS_8_0\n#endif\n\nstatic dispatch_queue_t url_session_manager_creation_queue() {\n    static dispatch_queue_t af_url_session_manager_creation_queue;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        af_url_session_manager_creation_queue = dispatch_queue_create(\"com.alamofire.networking.session.manager.creation\", DISPATCH_QUEUE_SERIAL);\n    });\n\n    return af_url_session_manager_creation_queue;\n}\n\nstatic void url_session_manager_create_task_safely(dispatch_block_t block) {\n    if (NSFoundationVersionNumber < NSFoundationVersionNumber_With_Fixed_5871104061079552_bug) {\n        // Fix of bug\n        // Open Radar:http://openradar.appspot.com/radar?id=5871104061079552 (status: Fixed in iOS8)\n        // Issue about:https://github.com/AFNetworking/AFNetworking/issues/2093\n        dispatch_sync(url_session_manager_creation_queue(), block);\n    } else {\n        block();\n    }\n}\n\nstatic dispatch_queue_t url_session_manager_processing_queue() {\n    static dispatch_queue_t af_url_session_manager_processing_queue;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        af_url_session_manager_processing_queue = dispatch_queue_create(\"com.alamofire.networking.session.manager.processing\", DISPATCH_QUEUE_CONCURRENT);\n    });\n\n    return af_url_session_manager_processing_queue;\n}\n\nstatic dispatch_group_t url_session_manager_completion_group() {\n    static dispatch_group_t af_url_session_manager_completion_group;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        af_url_session_manager_completion_group = dispatch_group_create();\n    });\n\n    return af_url_session_manager_completion_group;\n}\n\nNSString * const AFNetworkingTaskDidResumeNotification = @\"com.alamofire.networking.task.resume\";\nNSString * const AFNetworkingTaskDidCompleteNotification = @\"com.alamofire.networking.task.complete\";\nNSString * const AFNetworkingTaskDidSuspendNotification = @\"com.alamofire.networking.task.suspend\";\nNSString * const AFURLSessionDidInvalidateNotification = @\"com.alamofire.networking.session.invalidate\";\nNSString * const AFURLSessionDownloadTaskDidFailToMoveFileNotification = @\"com.alamofire.networking.session.download.file-manager-error\";\n\nNSString * const AFNetworkingTaskDidCompleteSerializedResponseKey = @\"com.alamofire.networking.task.complete.serializedresponse\";\nNSString * const AFNetworkingTaskDidCompleteResponseSerializerKey = @\"com.alamofire.networking.task.complete.responseserializer\";\nNSString * const AFNetworkingTaskDidCompleteResponseDataKey = @\"com.alamofire.networking.complete.finish.responsedata\";\nNSString * const AFNetworkingTaskDidCompleteErrorKey = @\"com.alamofire.networking.task.complete.error\";\nNSString * const AFNetworkingTaskDidCompleteAssetPathKey = @\"com.alamofire.networking.task.complete.assetpath\";\n\nstatic NSString * const AFURLSessionManagerLockName = @\"com.alamofire.networking.session.manager.lock\";\n\nstatic NSUInteger const AFMaximumNumberOfAttemptsToRecreateBackgroundSessionUploadTask = 3;\n\nstatic void * AFTaskStateChangedContext = &AFTaskStateChangedContext;\n\ntypedef void (^AFURLSessionDidBecomeInvalidBlock)(NSURLSession *session, NSError *error);\ntypedef NSURLSessionAuthChallengeDisposition (^AFURLSessionDidReceiveAuthenticationChallengeBlock)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential);\n\ntypedef NSURLRequest * (^AFURLSessionTaskWillPerformHTTPRedirectionBlock)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request);\ntypedef NSURLSessionAuthChallengeDisposition (^AFURLSessionTaskDidReceiveAuthenticationChallengeBlock)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential);\ntypedef void (^AFURLSessionDidFinishEventsForBackgroundURLSessionBlock)(NSURLSession *session);\n\ntypedef NSInputStream * (^AFURLSessionTaskNeedNewBodyStreamBlock)(NSURLSession *session, NSURLSessionTask *task);\ntypedef void (^AFURLSessionTaskDidSendBodyDataBlock)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend);\ntypedef void (^AFURLSessionTaskDidCompleteBlock)(NSURLSession *session, NSURLSessionTask *task, NSError *error);\n\ntypedef NSURLSessionResponseDisposition (^AFURLSessionDataTaskDidReceiveResponseBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLResponse *response);\ntypedef void (^AFURLSessionDataTaskDidBecomeDownloadTaskBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLSessionDownloadTask *downloadTask);\ntypedef void (^AFURLSessionDataTaskDidReceiveDataBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSData *data);\ntypedef NSCachedURLResponse * (^AFURLSessionDataTaskWillCacheResponseBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSCachedURLResponse *proposedResponse);\n\ntypedef NSURL * (^AFURLSessionDownloadTaskDidFinishDownloadingBlock)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location);\ntypedef void (^AFURLSessionDownloadTaskDidWriteDataBlock)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite);\ntypedef void (^AFURLSessionDownloadTaskDidResumeBlock)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t fileOffset, int64_t expectedTotalBytes);\ntypedef void (^AFURLSessionTaskProgressBlock)(NSProgress *);\n\ntypedef void (^AFURLSessionTaskCompletionHandler)(NSURLResponse *response, id responseObject, NSError *error);\n\n\n#pragma mark -\n\n@interface AFURLSessionManagerTaskDelegate : NSObject <NSURLSessionTaskDelegate, NSURLSessionDataDelegate, NSURLSessionDownloadDelegate>\n@property (nonatomic, weak) AFURLSessionManager *manager;\n@property (nonatomic, strong) NSMutableData *mutableData;\n@property (nonatomic, strong) NSProgress *uploadProgress;\n@property (nonatomic, strong) NSProgress *downloadProgress;\n@property (nonatomic, copy) NSURL *downloadFileURL;\n@property (nonatomic, copy) AFURLSessionDownloadTaskDidFinishDownloadingBlock downloadTaskDidFinishDownloading;\n@property (nonatomic, copy) AFURLSessionTaskProgressBlock uploadProgressBlock;\n@property (nonatomic, copy) AFURLSessionTaskProgressBlock downloadProgressBlock;\n@property (nonatomic, copy) AFURLSessionTaskCompletionHandler completionHandler;\n@end\n\n@implementation AFURLSessionManagerTaskDelegate\n\n- (instancetype)init {\n    self = [super init];\n    if (!self) {\n        return nil;\n    }\n\n    self.mutableData = [NSMutableData data];\n    self.uploadProgress = [[NSProgress alloc] initWithParent:nil userInfo:nil];\n    self.uploadProgress.totalUnitCount = NSURLSessionTransferSizeUnknown;\n\n    self.downloadProgress = [[NSProgress alloc] initWithParent:nil userInfo:nil];\n    self.downloadProgress.totalUnitCount = NSURLSessionTransferSizeUnknown;\n    return self;\n}\n\n#pragma mark - NSProgress Tracking\n\n- (void)setupProgressForTask:(NSURLSessionTask *)task {\n    __weak __typeof__(task) weakTask = task;\n\n    self.uploadProgress.totalUnitCount = task.countOfBytesExpectedToSend;\n    self.downloadProgress.totalUnitCount = task.countOfBytesExpectedToReceive;\n    [self.uploadProgress setCancellable:YES];\n    [self.uploadProgress setCancellationHandler:^{\n        __typeof__(weakTask) strongTask = weakTask;\n        [strongTask cancel];\n    }];\n    [self.uploadProgress setPausable:YES];\n    [self.uploadProgress setPausingHandler:^{\n        __typeof__(weakTask) strongTask = weakTask;\n        [strongTask suspend];\n    }];\n    if ([self.uploadProgress respondsToSelector:@selector(setResumingHandler:)]) {\n        [self.uploadProgress setResumingHandler:^{\n            __typeof__(weakTask) strongTask = weakTask;\n            [strongTask resume];\n        }];\n    }\n\n    [self.downloadProgress setCancellable:YES];\n    [self.downloadProgress setCancellationHandler:^{\n        __typeof__(weakTask) strongTask = weakTask;\n        [strongTask cancel];\n    }];\n    [self.downloadProgress setPausable:YES];\n    [self.downloadProgress setPausingHandler:^{\n        __typeof__(weakTask) strongTask = weakTask;\n        [strongTask suspend];\n    }];\n\n    if ([self.downloadProgress respondsToSelector:@selector(setResumingHandler:)]) {\n        [self.downloadProgress setResumingHandler:^{\n            __typeof__(weakTask) strongTask = weakTask;\n            [strongTask resume];\n        }];\n    }\n\n    [task addObserver:self\n           forKeyPath:NSStringFromSelector(@selector(countOfBytesReceived))\n              options:NSKeyValueObservingOptionNew\n              context:NULL];\n    [task addObserver:self\n           forKeyPath:NSStringFromSelector(@selector(countOfBytesExpectedToReceive))\n              options:NSKeyValueObservingOptionNew\n              context:NULL];\n\n    [task addObserver:self\n           forKeyPath:NSStringFromSelector(@selector(countOfBytesSent))\n              options:NSKeyValueObservingOptionNew\n              context:NULL];\n    [task addObserver:self\n           forKeyPath:NSStringFromSelector(@selector(countOfBytesExpectedToSend))\n              options:NSKeyValueObservingOptionNew\n              context:NULL];\n\n    [self.downloadProgress addObserver:self\n                            forKeyPath:NSStringFromSelector(@selector(fractionCompleted))\n                               options:NSKeyValueObservingOptionNew\n                               context:NULL];\n    [self.uploadProgress addObserver:self\n                          forKeyPath:NSStringFromSelector(@selector(fractionCompleted))\n                             options:NSKeyValueObservingOptionNew\n                             context:NULL];\n}\n\n- (void)cleanUpProgressForTask:(NSURLSessionTask *)task {\n    [task removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesReceived))];\n    [task removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesExpectedToReceive))];\n    [task removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesSent))];\n    [task removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesExpectedToSend))];\n    [self.downloadProgress removeObserver:self forKeyPath:NSStringFromSelector(@selector(fractionCompleted))];\n    [self.uploadProgress removeObserver:self forKeyPath:NSStringFromSelector(@selector(fractionCompleted))];\n}\n\n- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *,id> *)change context:(void *)context {\n    if ([object isKindOfClass:[NSURLSessionTask class]] || [object isKindOfClass:[NSURLSessionDownloadTask class]]) {\n        if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesReceived))]) {\n            self.downloadProgress.completedUnitCount = [change[NSKeyValueChangeNewKey] longLongValue];\n        } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesExpectedToReceive))]) {\n            self.downloadProgress.totalUnitCount = [change[NSKeyValueChangeNewKey] longLongValue];\n        } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesSent))]) {\n            self.uploadProgress.completedUnitCount = [change[NSKeyValueChangeNewKey] longLongValue];\n        } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesExpectedToSend))]) {\n            self.uploadProgress.totalUnitCount = [change[NSKeyValueChangeNewKey] longLongValue];\n        }\n    }\n    else if ([object isEqual:self.downloadProgress]) {\n        if (self.downloadProgressBlock) {\n            self.downloadProgressBlock(object);\n        }\n    }\n    else if ([object isEqual:self.uploadProgress]) {\n        if (self.uploadProgressBlock) {\n            self.uploadProgressBlock(object);\n        }\n    }\n}\n\n#pragma mark - NSURLSessionTaskDelegate\n\n- (void)URLSession:(__unused NSURLSession *)session\n              task:(NSURLSessionTask *)task\ndidCompleteWithError:(NSError *)error\n{\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wgnu\"\n    __strong AFURLSessionManager *manager = self.manager;\n\n    __block id responseObject = nil;\n\n    __block NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];\n    userInfo[AFNetworkingTaskDidCompleteResponseSerializerKey] = manager.responseSerializer;\n\n    //Performance Improvement from #2672\n    NSData *data = nil;\n    if (self.mutableData) {\n        data = [self.mutableData copy];\n        //We no longer need the reference, so nil it out to gain back some memory.\n        self.mutableData = nil;\n    }\n\n    if (self.downloadFileURL) {\n        userInfo[AFNetworkingTaskDidCompleteAssetPathKey] = self.downloadFileURL;\n    } else if (data) {\n        userInfo[AFNetworkingTaskDidCompleteResponseDataKey] = data;\n    }\n\n    if (error) {\n        userInfo[AFNetworkingTaskDidCompleteErrorKey] = error;\n\n        dispatch_group_async(manager.completionGroup ?: url_session_manager_completion_group(), manager.completionQueue ?: dispatch_get_main_queue(), ^{\n            if (self.completionHandler) {\n                self.completionHandler(task.response, responseObject, error);\n            }\n\n            dispatch_async(dispatch_get_main_queue(), ^{\n                [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingTaskDidCompleteNotification object:task userInfo:userInfo];\n            });\n        });\n    } else {\n        dispatch_async(url_session_manager_processing_queue(), ^{\n            NSError *serializationError = nil;\n            responseObject = [manager.responseSerializer responseObjectForResponse:task.response data:data error:&serializationError];\n\n            if (self.downloadFileURL) {\n                responseObject = self.downloadFileURL;\n            }\n\n            if (responseObject) {\n                userInfo[AFNetworkingTaskDidCompleteSerializedResponseKey] = responseObject;\n            }\n\n            if (serializationError) {\n                userInfo[AFNetworkingTaskDidCompleteErrorKey] = serializationError;\n            }\n\n            dispatch_group_async(manager.completionGroup ?: url_session_manager_completion_group(), manager.completionQueue ?: dispatch_get_main_queue(), ^{\n                if (self.completionHandler) {\n                    self.completionHandler(task.response, responseObject, serializationError);\n                }\n\n                dispatch_async(dispatch_get_main_queue(), ^{\n                    [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingTaskDidCompleteNotification object:task userInfo:userInfo];\n                });\n            });\n        });\n    }\n#pragma clang diagnostic pop\n}\n\n#pragma mark - NSURLSessionDataTaskDelegate\n\n- (void)URLSession:(__unused NSURLSession *)session\n          dataTask:(__unused NSURLSessionDataTask *)dataTask\n    didReceiveData:(NSData *)data\n{\n    [self.mutableData appendData:data];\n}\n\n#pragma mark - NSURLSessionDownloadTaskDelegate\n\n- (void)URLSession:(NSURLSession *)session\n      downloadTask:(NSURLSessionDownloadTask *)downloadTask\ndidFinishDownloadingToURL:(NSURL *)location\n{\n    NSError *fileManagerError = nil;\n    self.downloadFileURL = nil;\n\n    if (self.downloadTaskDidFinishDownloading) {\n        self.downloadFileURL = self.downloadTaskDidFinishDownloading(session, downloadTask, location);\n        if (self.downloadFileURL) {\n            [[NSFileManager defaultManager] moveItemAtURL:location toURL:self.downloadFileURL error:&fileManagerError];\n\n            if (fileManagerError) {\n                [[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDownloadTaskDidFailToMoveFileNotification object:downloadTask userInfo:fileManagerError.userInfo];\n            }\n        }\n    }\n}\n\n@end\n\n#pragma mark -\n\n/**\n *  A workaround for issues related to key-value observing the `state` of an `NSURLSessionTask`.\n *\n *  See:\n *  - https://github.com/AFNetworking/AFNetworking/issues/1477\n *  - https://github.com/AFNetworking/AFNetworking/issues/2638\n *  - https://github.com/AFNetworking/AFNetworking/pull/2702\n */\n\nstatic inline void af_swizzleSelector(Class theClass, SEL originalSelector, SEL swizzledSelector) {\n    Method originalMethod = class_getInstanceMethod(theClass, originalSelector);\n    Method swizzledMethod = class_getInstanceMethod(theClass, swizzledSelector);\n    method_exchangeImplementations(originalMethod, swizzledMethod);\n}\n\nstatic inline BOOL af_addMethod(Class theClass, SEL selector, Method method) {\n    return class_addMethod(theClass, selector,  method_getImplementation(method),  method_getTypeEncoding(method));\n}\n\nstatic NSString * const AFNSURLSessionTaskDidResumeNotification  = @\"com.alamofire.networking.nsurlsessiontask.resume\";\nstatic NSString * const AFNSURLSessionTaskDidSuspendNotification = @\"com.alamofire.networking.nsurlsessiontask.suspend\";\n\n@interface _AFURLSessionTaskSwizzling : NSObject\n\n@end\n\n@implementation _AFURLSessionTaskSwizzling\n\n+ (void)load {\n    /**\n     WARNING: Trouble Ahead\n     https://github.com/AFNetworking/AFNetworking/pull/2702\n     */\n\n    if (NSClassFromString(@\"NSURLSessionTask\")) {\n        /**\n         iOS 7 and iOS 8 differ in NSURLSessionTask implementation, which makes the next bit of code a bit tricky.\n         Many Unit Tests have been built to validate as much of this behavior has possible.\n         Here is what we know:\n            - NSURLSessionTasks are implemented with class clusters, meaning the class you request from the API isn't actually the type of class you will get back.\n            - Simply referencing `[NSURLSessionTask class]` will not work. You need to ask an `NSURLSession` to actually create an object, and grab the class from there.\n            - On iOS 7, `localDataTask` is a `__NSCFLocalDataTask`, which inherits from `__NSCFLocalSessionTask`, which inherits from `__NSCFURLSessionTask`.\n            - On iOS 8, `localDataTask` is a `__NSCFLocalDataTask`, which inherits from `__NSCFLocalSessionTask`, which inherits from `NSURLSessionTask`.\n            - On iOS 7, `__NSCFLocalSessionTask` and `__NSCFURLSessionTask` are the only two classes that have their own implementations of `resume` and `suspend`, and `__NSCFLocalSessionTask` DOES NOT CALL SUPER. This means both classes need to be swizzled.\n            - On iOS 8, `NSURLSessionTask` is the only class that implements `resume` and `suspend`. This means this is the only class that needs to be swizzled.\n            - Because `NSURLSessionTask` is not involved in the class hierarchy for every version of iOS, its easier to add the swizzled methods to a dummy class and manage them there.\n        \n         Some Assumptions:\n            - No implementations of `resume` or `suspend` call super. If this were to change in a future version of iOS, we'd need to handle it.\n            - No background task classes override `resume` or `suspend`\n         \n         The current solution:\n            1) Grab an instance of `__NSCFLocalDataTask` by asking an instance of `NSURLSession` for a data task.\n            2) Grab a pointer to the original implementation of `af_resume`\n            3) Check to see if the current class has an implementation of resume. If so, continue to step 4.\n            4) Grab the super class of the current class.\n            5) Grab a pointer for the current class to the current implementation of `resume`.\n            6) Grab a pointer for the super class to the current implementation of `resume`.\n            7) If the current class implementation of `resume` is not equal to the super class implementation of `resume` AND the current implementation of `resume` is not equal to the original implementation of `af_resume`, THEN swizzle the methods\n            8) Set the current class to the super class, and repeat steps 3-8\n         */\n        NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration ephemeralSessionConfiguration];\n        NSURLSession * session = [NSURLSession sessionWithConfiguration:configuration];\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wnonnull\"\n        NSURLSessionDataTask *localDataTask = [session dataTaskWithURL:nil];\n#pragma clang diagnostic pop\n        IMP originalAFResumeIMP = method_getImplementation(class_getInstanceMethod([self class], @selector(af_resume)));\n        Class currentClass = [localDataTask class];\n        \n        while (class_getInstanceMethod(currentClass, @selector(resume))) {\n            Class superClass = [currentClass superclass];\n            IMP classResumeIMP = method_getImplementation(class_getInstanceMethod(currentClass, @selector(resume)));\n            IMP superclassResumeIMP = method_getImplementation(class_getInstanceMethod(superClass, @selector(resume)));\n            if (classResumeIMP != superclassResumeIMP &&\n                originalAFResumeIMP != classResumeIMP) {\n                [self swizzleResumeAndSuspendMethodForClass:currentClass];\n            }\n            currentClass = [currentClass superclass];\n        }\n        \n        [localDataTask cancel];\n        [session finishTasksAndInvalidate];\n    }\n}\n\n+ (void)swizzleResumeAndSuspendMethodForClass:(Class)theClass {\n    Method afResumeMethod = class_getInstanceMethod(self, @selector(af_resume));\n    Method afSuspendMethod = class_getInstanceMethod(self, @selector(af_suspend));\n\n    if (af_addMethod(theClass, @selector(af_resume), afResumeMethod)) {\n        af_swizzleSelector(theClass, @selector(resume), @selector(af_resume));\n    }\n\n    if (af_addMethod(theClass, @selector(af_suspend), afSuspendMethod)) {\n        af_swizzleSelector(theClass, @selector(suspend), @selector(af_suspend));\n    }\n}\n\n- (NSURLSessionTaskState)state {\n    NSAssert(NO, @\"State method should never be called in the actual dummy class\");\n    return NSURLSessionTaskStateCanceling;\n}\n\n- (void)af_resume {\n    NSAssert([self respondsToSelector:@selector(state)], @\"Does not respond to state\");\n    NSURLSessionTaskState state = [self state];\n    [self af_resume];\n    \n    if (state != NSURLSessionTaskStateRunning) {\n        [[NSNotificationCenter defaultCenter] postNotificationName:AFNSURLSessionTaskDidResumeNotification object:self];\n    }\n}\n\n- (void)af_suspend {\n    NSAssert([self respondsToSelector:@selector(state)], @\"Does not respond to state\");\n    NSURLSessionTaskState state = [self state];\n    [self af_suspend];\n    \n    if (state != NSURLSessionTaskStateSuspended) {\n        [[NSNotificationCenter defaultCenter] postNotificationName:AFNSURLSessionTaskDidSuspendNotification object:self];\n    }\n}\n@end\n\n#pragma mark -\n\n@interface AFURLSessionManager ()\n@property (readwrite, nonatomic, strong) NSURLSessionConfiguration *sessionConfiguration;\n@property (readwrite, nonatomic, strong) NSOperationQueue *operationQueue;\n@property (readwrite, nonatomic, strong) NSURLSession *session;\n@property (readwrite, nonatomic, strong) NSMutableDictionary *mutableTaskDelegatesKeyedByTaskIdentifier;\n@property (readonly, nonatomic, copy) NSString *taskDescriptionForSessionTasks;\n@property (readwrite, nonatomic, strong) NSLock *lock;\n@property (readwrite, nonatomic, copy) AFURLSessionDidBecomeInvalidBlock sessionDidBecomeInvalid;\n@property (readwrite, nonatomic, copy) AFURLSessionDidReceiveAuthenticationChallengeBlock sessionDidReceiveAuthenticationChallenge;\n@property (readwrite, nonatomic, copy) AFURLSessionDidFinishEventsForBackgroundURLSessionBlock didFinishEventsForBackgroundURLSession;\n@property (readwrite, nonatomic, copy) AFURLSessionTaskWillPerformHTTPRedirectionBlock taskWillPerformHTTPRedirection;\n@property (readwrite, nonatomic, copy) AFURLSessionTaskDidReceiveAuthenticationChallengeBlock taskDidReceiveAuthenticationChallenge;\n@property (readwrite, nonatomic, copy) AFURLSessionTaskNeedNewBodyStreamBlock taskNeedNewBodyStream;\n@property (readwrite, nonatomic, copy) AFURLSessionTaskDidSendBodyDataBlock taskDidSendBodyData;\n@property (readwrite, nonatomic, copy) AFURLSessionTaskDidCompleteBlock taskDidComplete;\n@property (readwrite, nonatomic, copy) AFURLSessionDataTaskDidReceiveResponseBlock dataTaskDidReceiveResponse;\n@property (readwrite, nonatomic, copy) AFURLSessionDataTaskDidBecomeDownloadTaskBlock dataTaskDidBecomeDownloadTask;\n@property (readwrite, nonatomic, copy) AFURLSessionDataTaskDidReceiveDataBlock dataTaskDidReceiveData;\n@property (readwrite, nonatomic, copy) AFURLSessionDataTaskWillCacheResponseBlock dataTaskWillCacheResponse;\n@property (readwrite, nonatomic, copy) AFURLSessionDownloadTaskDidFinishDownloadingBlock downloadTaskDidFinishDownloading;\n@property (readwrite, nonatomic, copy) AFURLSessionDownloadTaskDidWriteDataBlock downloadTaskDidWriteData;\n@property (readwrite, nonatomic, copy) AFURLSessionDownloadTaskDidResumeBlock downloadTaskDidResume;\n@end\n\n@implementation AFURLSessionManager\n\n- (instancetype)init {\n    return [self initWithSessionConfiguration:nil];\n}\n\n- (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration {\n    self = [super init];\n    if (!self) {\n        return nil;\n    }\n\n    if (!configuration) {\n        configuration = [NSURLSessionConfiguration defaultSessionConfiguration];\n    }\n\n    self.sessionConfiguration = configuration;\n\n    self.operationQueue = [[NSOperationQueue alloc] init];\n    self.operationQueue.maxConcurrentOperationCount = 1;\n\n    self.session = [NSURLSession sessionWithConfiguration:self.sessionConfiguration delegate:self delegateQueue:self.operationQueue];\n\n    self.responseSerializer = [AFJSONResponseSerializer serializer];\n\n    self.securityPolicy = [AFSecurityPolicy defaultPolicy];\n\n#if !TARGET_OS_WATCH\n    self.reachabilityManager = [AFNetworkReachabilityManager sharedManager];\n#endif\n\n    self.mutableTaskDelegatesKeyedByTaskIdentifier = [[NSMutableDictionary alloc] init];\n\n    self.lock = [[NSLock alloc] init];\n    self.lock.name = AFURLSessionManagerLockName;\n\n    [self.session getTasksWithCompletionHandler:^(NSArray *dataTasks, NSArray *uploadTasks, NSArray *downloadTasks) {\n        for (NSURLSessionDataTask *task in dataTasks) {\n            [self addDelegateForDataTask:task uploadProgress:nil downloadProgress:nil completionHandler:nil];\n        }\n\n        for (NSURLSessionUploadTask *uploadTask in uploadTasks) {\n            [self addDelegateForUploadTask:uploadTask progress:nil completionHandler:nil];\n        }\n\n        for (NSURLSessionDownloadTask *downloadTask in downloadTasks) {\n            [self addDelegateForDownloadTask:downloadTask progress:nil destination:nil completionHandler:nil];\n        }\n    }];\n\n    return self;\n}\n\n- (void)dealloc {\n    [[NSNotificationCenter defaultCenter] removeObserver:self];\n}\n\n#pragma mark -\n\n- (NSString *)taskDescriptionForSessionTasks {\n    return [NSString stringWithFormat:@\"%p\", self];\n}\n\n- (void)taskDidResume:(NSNotification *)notification {\n    NSURLSessionTask *task = notification.object;\n    if ([task respondsToSelector:@selector(taskDescription)]) {\n        if ([task.taskDescription isEqualToString:self.taskDescriptionForSessionTasks]) {\n            dispatch_async(dispatch_get_main_queue(), ^{\n                [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingTaskDidResumeNotification object:task];\n            });\n        }\n    }\n}\n\n- (void)taskDidSuspend:(NSNotification *)notification {\n    NSURLSessionTask *task = notification.object;\n    if ([task respondsToSelector:@selector(taskDescription)]) {\n        if ([task.taskDescription isEqualToString:self.taskDescriptionForSessionTasks]) {\n            dispatch_async(dispatch_get_main_queue(), ^{\n                [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingTaskDidSuspendNotification object:task];\n            });\n        }\n    }\n}\n\n#pragma mark -\n\n- (AFURLSessionManagerTaskDelegate *)delegateForTask:(NSURLSessionTask *)task {\n    NSParameterAssert(task);\n\n    AFURLSessionManagerTaskDelegate *delegate = nil;\n    [self.lock lock];\n    delegate = self.mutableTaskDelegatesKeyedByTaskIdentifier[@(task.taskIdentifier)];\n    [self.lock unlock];\n\n    return delegate;\n}\n\n- (void)setDelegate:(AFURLSessionManagerTaskDelegate *)delegate\n            forTask:(NSURLSessionTask *)task\n{\n    NSParameterAssert(task);\n    NSParameterAssert(delegate);\n\n    [self.lock lock];\n    self.mutableTaskDelegatesKeyedByTaskIdentifier[@(task.taskIdentifier)] = delegate;\n    [delegate setupProgressForTask:task];\n    [self addNotificationObserverForTask:task];\n    [self.lock unlock];\n}\n\n- (void)addDelegateForDataTask:(NSURLSessionDataTask *)dataTask\n                uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgressBlock\n              downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgressBlock\n             completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler\n{\n    AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] init];\n    delegate.manager = self;\n    delegate.completionHandler = completionHandler;\n\n    dataTask.taskDescription = self.taskDescriptionForSessionTasks;\n    [self setDelegate:delegate forTask:dataTask];\n\n    delegate.uploadProgressBlock = uploadProgressBlock;\n    delegate.downloadProgressBlock = downloadProgressBlock;\n}\n\n- (void)addDelegateForUploadTask:(NSURLSessionUploadTask *)uploadTask\n                        progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock\n               completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler\n{\n    AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] init];\n    delegate.manager = self;\n    delegate.completionHandler = completionHandler;\n\n    uploadTask.taskDescription = self.taskDescriptionForSessionTasks;\n\n    [self setDelegate:delegate forTask:uploadTask];\n\n    delegate.uploadProgressBlock = uploadProgressBlock;\n}\n\n- (void)addDelegateForDownloadTask:(NSURLSessionDownloadTask *)downloadTask\n                          progress:(void (^)(NSProgress *downloadProgress)) downloadProgressBlock\n                       destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination\n                 completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler\n{\n    AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] init];\n    delegate.manager = self;\n    delegate.completionHandler = completionHandler;\n\n    if (destination) {\n        delegate.downloadTaskDidFinishDownloading = ^NSURL * (NSURLSession * __unused session, NSURLSessionDownloadTask *task, NSURL *location) {\n            return destination(location, task.response);\n        };\n    }\n\n    downloadTask.taskDescription = self.taskDescriptionForSessionTasks;\n\n    [self setDelegate:delegate forTask:downloadTask];\n\n    delegate.downloadProgressBlock = downloadProgressBlock;\n}\n\n- (void)removeDelegateForTask:(NSURLSessionTask *)task {\n    NSParameterAssert(task);\n\n    AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:task];\n    [self.lock lock];\n    [delegate cleanUpProgressForTask:task];\n    [self removeNotificationObserverForTask:task];\n    [self.mutableTaskDelegatesKeyedByTaskIdentifier removeObjectForKey:@(task.taskIdentifier)];\n    [self.lock unlock];\n}\n\n#pragma mark -\n\n- (NSArray *)tasksForKeyPath:(NSString *)keyPath {\n    __block NSArray *tasks = nil;\n    dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);\n    [self.session getTasksWithCompletionHandler:^(NSArray *dataTasks, NSArray *uploadTasks, NSArray *downloadTasks) {\n        if ([keyPath isEqualToString:NSStringFromSelector(@selector(dataTasks))]) {\n            tasks = dataTasks;\n        } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(uploadTasks))]) {\n            tasks = uploadTasks;\n        } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(downloadTasks))]) {\n            tasks = downloadTasks;\n        } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(tasks))]) {\n            tasks = [@[dataTasks, uploadTasks, downloadTasks] valueForKeyPath:@\"@unionOfArrays.self\"];\n        }\n\n        dispatch_semaphore_signal(semaphore);\n    }];\n\n    dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);\n\n    return tasks;\n}\n\n- (NSArray *)tasks {\n    return [self tasksForKeyPath:NSStringFromSelector(_cmd)];\n}\n\n- (NSArray *)dataTasks {\n    return [self tasksForKeyPath:NSStringFromSelector(_cmd)];\n}\n\n- (NSArray *)uploadTasks {\n    return [self tasksForKeyPath:NSStringFromSelector(_cmd)];\n}\n\n- (NSArray *)downloadTasks {\n    return [self tasksForKeyPath:NSStringFromSelector(_cmd)];\n}\n\n#pragma mark -\n\n- (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks {\n    dispatch_async(dispatch_get_main_queue(), ^{\n        if (cancelPendingTasks) {\n            [self.session invalidateAndCancel];\n        } else {\n            [self.session finishTasksAndInvalidate];\n        }\n    });\n}\n\n#pragma mark -\n\n- (void)setResponseSerializer:(id <AFURLResponseSerialization>)responseSerializer {\n    NSParameterAssert(responseSerializer);\n\n    _responseSerializer = responseSerializer;\n}\n\n#pragma mark -\n- (void)addNotificationObserverForTask:(NSURLSessionTask *)task {\n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(taskDidResume:) name:AFNSURLSessionTaskDidResumeNotification object:task];\n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(taskDidSuspend:) name:AFNSURLSessionTaskDidSuspendNotification object:task];\n}\n\n- (void)removeNotificationObserverForTask:(NSURLSessionTask *)task {\n    [[NSNotificationCenter defaultCenter] removeObserver:self name:AFNSURLSessionTaskDidSuspendNotification object:task];\n    [[NSNotificationCenter defaultCenter] removeObserver:self name:AFNSURLSessionTaskDidResumeNotification object:task];\n}\n\n#pragma mark -\n\n- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request\n                            completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler\n{\n    return [self dataTaskWithRequest:request uploadProgress:nil downloadProgress:nil completionHandler:completionHandler];\n}\n\n- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request\n                               uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgressBlock\n                             downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgressBlock\n                            completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject,  NSError * _Nullable error))completionHandler {\n\n    __block NSURLSessionDataTask *dataTask = nil;\n    url_session_manager_create_task_safely(^{\n        dataTask = [self.session dataTaskWithRequest:request];\n    });\n\n    [self addDelegateForDataTask:dataTask uploadProgress:uploadProgressBlock downloadProgress:downloadProgressBlock completionHandler:completionHandler];\n\n    return dataTask;\n}\n\n#pragma mark -\n\n- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request\n                                         fromFile:(NSURL *)fileURL\n                                         progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock\n                                completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler\n{\n    __block NSURLSessionUploadTask *uploadTask = nil;\n    url_session_manager_create_task_safely(^{\n        uploadTask = [self.session uploadTaskWithRequest:request fromFile:fileURL];\n    });\n\n    if (!uploadTask && self.attemptsToRecreateUploadTasksForBackgroundSessions && self.session.configuration.identifier) {\n        for (NSUInteger attempts = 0; !uploadTask && attempts < AFMaximumNumberOfAttemptsToRecreateBackgroundSessionUploadTask; attempts++) {\n            uploadTask = [self.session uploadTaskWithRequest:request fromFile:fileURL];\n        }\n    }\n\n    [self addDelegateForUploadTask:uploadTask progress:uploadProgressBlock completionHandler:completionHandler];\n\n    return uploadTask;\n}\n\n- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request\n                                         fromData:(NSData *)bodyData\n                                         progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock\n                                completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler\n{\n    __block NSURLSessionUploadTask *uploadTask = nil;\n    url_session_manager_create_task_safely(^{\n        uploadTask = [self.session uploadTaskWithRequest:request fromData:bodyData];\n    });\n\n    [self addDelegateForUploadTask:uploadTask progress:uploadProgressBlock completionHandler:completionHandler];\n\n    return uploadTask;\n}\n\n- (NSURLSessionUploadTask *)uploadTaskWithStreamedRequest:(NSURLRequest *)request\n                                                 progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock\n                                        completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler\n{\n    __block NSURLSessionUploadTask *uploadTask = nil;\n    url_session_manager_create_task_safely(^{\n        uploadTask = [self.session uploadTaskWithStreamedRequest:request];\n    });\n\n    [self addDelegateForUploadTask:uploadTask progress:uploadProgressBlock completionHandler:completionHandler];\n\n    return uploadTask;\n}\n\n#pragma mark -\n\n- (NSURLSessionDownloadTask *)downloadTaskWithRequest:(NSURLRequest *)request\n                                             progress:(void (^)(NSProgress *downloadProgress)) downloadProgressBlock\n                                          destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination\n                                    completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler\n{\n    __block NSURLSessionDownloadTask *downloadTask = nil;\n    url_session_manager_create_task_safely(^{\n        downloadTask = [self.session downloadTaskWithRequest:request];\n    });\n\n    [self addDelegateForDownloadTask:downloadTask progress:downloadProgressBlock destination:destination completionHandler:completionHandler];\n\n    return downloadTask;\n}\n\n- (NSURLSessionDownloadTask *)downloadTaskWithResumeData:(NSData *)resumeData\n                                                progress:(void (^)(NSProgress *downloadProgress)) downloadProgressBlock\n                                             destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination\n                                       completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler\n{\n    __block NSURLSessionDownloadTask *downloadTask = nil;\n    url_session_manager_create_task_safely(^{\n        downloadTask = [self.session downloadTaskWithResumeData:resumeData];\n    });\n\n    [self addDelegateForDownloadTask:downloadTask progress:downloadProgressBlock destination:destination completionHandler:completionHandler];\n\n    return downloadTask;\n}\n\n#pragma mark -\n- (NSProgress *)uploadProgressForTask:(NSURLSessionTask *)task {\n    return [[self delegateForTask:task] uploadProgress];\n}\n\n- (NSProgress *)downloadProgressForTask:(NSURLSessionTask *)task {\n    return [[self delegateForTask:task] downloadProgress];\n}\n\n#pragma mark -\n\n- (void)setSessionDidBecomeInvalidBlock:(void (^)(NSURLSession *session, NSError *error))block {\n    self.sessionDidBecomeInvalid = block;\n}\n\n- (void)setSessionDidReceiveAuthenticationChallengeBlock:(NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential))block {\n    self.sessionDidReceiveAuthenticationChallenge = block;\n}\n\n- (void)setDidFinishEventsForBackgroundURLSessionBlock:(void (^)(NSURLSession *session))block {\n    self.didFinishEventsForBackgroundURLSession = block;\n}\n\n#pragma mark -\n\n- (void)setTaskNeedNewBodyStreamBlock:(NSInputStream * (^)(NSURLSession *session, NSURLSessionTask *task))block {\n    self.taskNeedNewBodyStream = block;\n}\n\n- (void)setTaskWillPerformHTTPRedirectionBlock:(NSURLRequest * (^)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request))block {\n    self.taskWillPerformHTTPRedirection = block;\n}\n\n- (void)setTaskDidReceiveAuthenticationChallengeBlock:(NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential))block {\n    self.taskDidReceiveAuthenticationChallenge = block;\n}\n\n- (void)setTaskDidSendBodyDataBlock:(void (^)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend))block {\n    self.taskDidSendBodyData = block;\n}\n\n- (void)setTaskDidCompleteBlock:(void (^)(NSURLSession *session, NSURLSessionTask *task, NSError *error))block {\n    self.taskDidComplete = block;\n}\n\n#pragma mark -\n\n- (void)setDataTaskDidReceiveResponseBlock:(NSURLSessionResponseDisposition (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLResponse *response))block {\n    self.dataTaskDidReceiveResponse = block;\n}\n\n- (void)setDataTaskDidBecomeDownloadTaskBlock:(void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLSessionDownloadTask *downloadTask))block {\n    self.dataTaskDidBecomeDownloadTask = block;\n}\n\n- (void)setDataTaskDidReceiveDataBlock:(void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSData *data))block {\n    self.dataTaskDidReceiveData = block;\n}\n\n- (void)setDataTaskWillCacheResponseBlock:(NSCachedURLResponse * (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSCachedURLResponse *proposedResponse))block {\n    self.dataTaskWillCacheResponse = block;\n}\n\n#pragma mark -\n\n- (void)setDownloadTaskDidFinishDownloadingBlock:(NSURL * (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location))block {\n    self.downloadTaskDidFinishDownloading = block;\n}\n\n- (void)setDownloadTaskDidWriteDataBlock:(void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite))block {\n    self.downloadTaskDidWriteData = block;\n}\n\n- (void)setDownloadTaskDidResumeBlock:(void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t fileOffset, int64_t expectedTotalBytes))block {\n    self.downloadTaskDidResume = block;\n}\n\n#pragma mark - NSObject\n\n- (NSString *)description {\n    return [NSString stringWithFormat:@\"<%@: %p, session: %@, operationQueue: %@>\", NSStringFromClass([self class]), self, self.session, self.operationQueue];\n}\n\n- (BOOL)respondsToSelector:(SEL)selector {\n    if (selector == @selector(URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:)) {\n        return self.taskWillPerformHTTPRedirection != nil;\n    } else if (selector == @selector(URLSession:dataTask:didReceiveResponse:completionHandler:)) {\n        return self.dataTaskDidReceiveResponse != nil;\n    } else if (selector == @selector(URLSession:dataTask:willCacheResponse:completionHandler:)) {\n        return self.dataTaskWillCacheResponse != nil;\n    } else if (selector == @selector(URLSessionDidFinishEventsForBackgroundURLSession:)) {\n        return self.didFinishEventsForBackgroundURLSession != nil;\n    }\n\n    return [[self class] instancesRespondToSelector:selector];\n}\n\n#pragma mark - NSURLSessionDelegate\n\n- (void)URLSession:(NSURLSession *)session\ndidBecomeInvalidWithError:(NSError *)error\n{\n    if (self.sessionDidBecomeInvalid) {\n        self.sessionDidBecomeInvalid(session, error);\n    }\n\n    [[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDidInvalidateNotification object:session];\n}\n\n- (void)URLSession:(NSURLSession *)session\ndidReceiveChallenge:(NSURLAuthenticationChallenge *)challenge\n completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler\n{\n    NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling;\n    __block NSURLCredential *credential = nil;\n\n    if (self.sessionDidReceiveAuthenticationChallenge) {\n        disposition = self.sessionDidReceiveAuthenticationChallenge(session, challenge, &credential);\n    } else {\n        if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {\n            if ([self.securityPolicy evaluateServerTrust:challenge.protectionSpace.serverTrust forDomain:challenge.protectionSpace.host]) {\n                credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];\n                if (credential) {\n                    disposition = NSURLSessionAuthChallengeUseCredential;\n                } else {\n                    disposition = NSURLSessionAuthChallengePerformDefaultHandling;\n                }\n            } else {\n                disposition = NSURLSessionAuthChallengeCancelAuthenticationChallenge;\n            }\n        } else {\n            disposition = NSURLSessionAuthChallengePerformDefaultHandling;\n        }\n    }\n\n    if (completionHandler) {\n        completionHandler(disposition, credential);\n    }\n}\n\n#pragma mark - NSURLSessionTaskDelegate\n\n- (void)URLSession:(NSURLSession *)session\n              task:(NSURLSessionTask *)task\nwillPerformHTTPRedirection:(NSHTTPURLResponse *)response\n        newRequest:(NSURLRequest *)request\n completionHandler:(void (^)(NSURLRequest *))completionHandler\n{\n    NSURLRequest *redirectRequest = request;\n\n    if (self.taskWillPerformHTTPRedirection) {\n        redirectRequest = self.taskWillPerformHTTPRedirection(session, task, response, request);\n    }\n\n    if (completionHandler) {\n        completionHandler(redirectRequest);\n    }\n}\n\n- (void)URLSession:(NSURLSession *)session\n              task:(NSURLSessionTask *)task\ndidReceiveChallenge:(NSURLAuthenticationChallenge *)challenge\n completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler\n{\n    NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling;\n    __block NSURLCredential *credential = nil;\n\n    if (self.taskDidReceiveAuthenticationChallenge) {\n        disposition = self.taskDidReceiveAuthenticationChallenge(session, task, challenge, &credential);\n    } else {\n        if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {\n            if ([self.securityPolicy evaluateServerTrust:challenge.protectionSpace.serverTrust forDomain:challenge.protectionSpace.host]) {\n                disposition = NSURLSessionAuthChallengeUseCredential;\n                credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];\n            } else {\n                disposition = NSURLSessionAuthChallengeCancelAuthenticationChallenge;\n            }\n        } else {\n            disposition = NSURLSessionAuthChallengePerformDefaultHandling;\n        }\n    }\n\n    if (completionHandler) {\n        completionHandler(disposition, credential);\n    }\n}\n\n- (void)URLSession:(NSURLSession *)session\n              task:(NSURLSessionTask *)task\n needNewBodyStream:(void (^)(NSInputStream *bodyStream))completionHandler\n{\n    NSInputStream *inputStream = nil;\n\n    if (self.taskNeedNewBodyStream) {\n        inputStream = self.taskNeedNewBodyStream(session, task);\n    } else if (task.originalRequest.HTTPBodyStream && [task.originalRequest.HTTPBodyStream conformsToProtocol:@protocol(NSCopying)]) {\n        inputStream = [task.originalRequest.HTTPBodyStream copy];\n    }\n\n    if (completionHandler) {\n        completionHandler(inputStream);\n    }\n}\n\n- (void)URLSession:(NSURLSession *)session\n              task:(NSURLSessionTask *)task\n   didSendBodyData:(int64_t)bytesSent\n    totalBytesSent:(int64_t)totalBytesSent\ntotalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend\n{\n\n    int64_t totalUnitCount = totalBytesExpectedToSend;\n    if(totalUnitCount == NSURLSessionTransferSizeUnknown) {\n        NSString *contentLength = [task.originalRequest valueForHTTPHeaderField:@\"Content-Length\"];\n        if(contentLength) {\n            totalUnitCount = (int64_t) [contentLength longLongValue];\n        }\n    }\n\n    if (self.taskDidSendBodyData) {\n        self.taskDidSendBodyData(session, task, bytesSent, totalBytesSent, totalUnitCount);\n    }\n}\n\n- (void)URLSession:(NSURLSession *)session\n              task:(NSURLSessionTask *)task\ndidCompleteWithError:(NSError *)error\n{\n    AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:task];\n\n    // delegate may be nil when completing a task in the background\n    if (delegate) {\n        [delegate URLSession:session task:task didCompleteWithError:error];\n\n        [self removeDelegateForTask:task];\n    }\n\n    if (self.taskDidComplete) {\n        self.taskDidComplete(session, task, error);\n    }\n}\n\n#pragma mark - NSURLSessionDataDelegate\n\n- (void)URLSession:(NSURLSession *)session\n          dataTask:(NSURLSessionDataTask *)dataTask\ndidReceiveResponse:(NSURLResponse *)response\n completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler\n{\n    NSURLSessionResponseDisposition disposition = NSURLSessionResponseAllow;\n\n    if (self.dataTaskDidReceiveResponse) {\n        disposition = self.dataTaskDidReceiveResponse(session, dataTask, response);\n    }\n\n    if (completionHandler) {\n        completionHandler(disposition);\n    }\n}\n\n- (void)URLSession:(NSURLSession *)session\n          dataTask:(NSURLSessionDataTask *)dataTask\ndidBecomeDownloadTask:(NSURLSessionDownloadTask *)downloadTask\n{\n    AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:dataTask];\n    if (delegate) {\n        [self removeDelegateForTask:dataTask];\n        [self setDelegate:delegate forTask:downloadTask];\n    }\n\n    if (self.dataTaskDidBecomeDownloadTask) {\n        self.dataTaskDidBecomeDownloadTask(session, dataTask, downloadTask);\n    }\n}\n\n- (void)URLSession:(NSURLSession *)session\n          dataTask:(NSURLSessionDataTask *)dataTask\n    didReceiveData:(NSData *)data\n{\n\n    AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:dataTask];\n    [delegate URLSession:session dataTask:dataTask didReceiveData:data];\n\n    if (self.dataTaskDidReceiveData) {\n        self.dataTaskDidReceiveData(session, dataTask, data);\n    }\n}\n\n- (void)URLSession:(NSURLSession *)session\n          dataTask:(NSURLSessionDataTask *)dataTask\n willCacheResponse:(NSCachedURLResponse *)proposedResponse\n completionHandler:(void (^)(NSCachedURLResponse *cachedResponse))completionHandler\n{\n    NSCachedURLResponse *cachedResponse = proposedResponse;\n\n    if (self.dataTaskWillCacheResponse) {\n        cachedResponse = self.dataTaskWillCacheResponse(session, dataTask, proposedResponse);\n    }\n\n    if (completionHandler) {\n        completionHandler(cachedResponse);\n    }\n}\n\n- (void)URLSessionDidFinishEventsForBackgroundURLSession:(NSURLSession *)session {\n    if (self.didFinishEventsForBackgroundURLSession) {\n        dispatch_async(dispatch_get_main_queue(), ^{\n            self.didFinishEventsForBackgroundURLSession(session);\n        });\n    }\n}\n\n#pragma mark - NSURLSessionDownloadDelegate\n\n- (void)URLSession:(NSURLSession *)session\n      downloadTask:(NSURLSessionDownloadTask *)downloadTask\ndidFinishDownloadingToURL:(NSURL *)location\n{\n    AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:downloadTask];\n    if (self.downloadTaskDidFinishDownloading) {\n        NSURL *fileURL = self.downloadTaskDidFinishDownloading(session, downloadTask, location);\n        if (fileURL) {\n            delegate.downloadFileURL = fileURL;\n            NSError *error = nil;\n            [[NSFileManager defaultManager] moveItemAtURL:location toURL:fileURL error:&error];\n            if (error) {\n                [[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDownloadTaskDidFailToMoveFileNotification object:downloadTask userInfo:error.userInfo];\n            }\n\n            return;\n        }\n    }\n\n    if (delegate) {\n        [delegate URLSession:session downloadTask:downloadTask didFinishDownloadingToURL:location];\n    }\n}\n\n- (void)URLSession:(NSURLSession *)session\n      downloadTask:(NSURLSessionDownloadTask *)downloadTask\n      didWriteData:(int64_t)bytesWritten\n totalBytesWritten:(int64_t)totalBytesWritten\ntotalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite\n{\n    if (self.downloadTaskDidWriteData) {\n        self.downloadTaskDidWriteData(session, downloadTask, bytesWritten, totalBytesWritten, totalBytesExpectedToWrite);\n    }\n}\n\n- (void)URLSession:(NSURLSession *)session\n      downloadTask:(NSURLSessionDownloadTask *)downloadTask\n didResumeAtOffset:(int64_t)fileOffset\nexpectedTotalBytes:(int64_t)expectedTotalBytes\n{\n    if (self.downloadTaskDidResume) {\n        self.downloadTaskDidResume(session, downloadTask, fileOffset, expectedTotalBytes);\n    }\n}\n\n#pragma mark - NSSecureCoding\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n- (instancetype)initWithCoder:(NSCoder *)decoder {\n    NSURLSessionConfiguration *configuration = [decoder decodeObjectOfClass:[NSURLSessionConfiguration class] forKey:@\"sessionConfiguration\"];\n\n    self = [self initWithSessionConfiguration:configuration];\n    if (!self) {\n        return nil;\n    }\n\n    return self;\n}\n\n- (void)encodeWithCoder:(NSCoder *)coder {\n    [coder encodeObject:self.session.configuration forKey:@\"sessionConfiguration\"];\n}\n\n#pragma mark - NSCopying\n\n- (instancetype)copyWithZone:(NSZone *)zone {\n    return [[[self class] allocWithZone:zone] initWithSessionConfiguration:self.session.configuration];\n}\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/LICENSE",
    "content": "Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/README.md",
    "content": "<p align=\"center\" >\n  <img src=\"https://raw.github.com/AFNetworking/AFNetworking/assets/afnetworking-logo.png\" alt=\"AFNetworking\" title=\"AFNetworking\">\n</p>\n\n[![Build Status](https://travis-ci.org/AFNetworking/AFNetworking.svg)](https://travis-ci.org/AFNetworking/AFNetworking)\n[![codecov.io](https://codecov.io/github/AFNetworking/AFNetworking/coverage.svg?branch=master)](https://codecov.io/github/AFNetworking/AFNetworking?branch=master)\n[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/AFNetworking.svg)](https://img.shields.io/cocoapods/v/AFNetworking.svg)\n[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Platform](https://img.shields.io/cocoapods/p/AFNetworking.svg?style=flat)](http://cocoadocs.org/docsets/AFNetworking)\n[![Twitter](https://img.shields.io/badge/twitter-@AFNetworking-blue.svg?style=flat)](http://twitter.com/AFNetworking)\n\nAFNetworking is a delightful networking library for iOS and Mac OS X. It's built on top of the [Foundation URL Loading System](http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/URLLoadingSystem/URLLoadingSystem.html), extending the powerful high-level networking abstractions built into Cocoa. It has a modular architecture with well-designed, feature-rich APIs that are a joy to use.\n\nPerhaps the most important feature of all, however, is the amazing community of developers who use and contribute to AFNetworking every day. AFNetworking powers some of the most popular and critically-acclaimed apps on the iPhone, iPad, and Mac.\n\nChoose AFNetworking for your next project, or migrate over your existing projects—you'll be happy you did!\n\n## How To Get Started\n\n- [Download AFNetworking](https://github.com/AFNetworking/AFNetworking/archive/master.zip) and try out the included Mac and iPhone example apps\n- Read the [\"Getting Started\" guide](https://github.com/AFNetworking/AFNetworking/wiki/Getting-Started-with-AFNetworking), [FAQ](https://github.com/AFNetworking/AFNetworking/wiki/AFNetworking-FAQ), or [other articles on the Wiki](https://github.com/AFNetworking/AFNetworking/wiki)\n- Check out the [documentation](http://cocoadocs.org/docsets/AFNetworking/) for a comprehensive look at all of the APIs available in AFNetworking\n- Read the [AFNetworking 3.0 Migration Guide](https://github.com/AFNetworking/AFNetworking/wiki/AFNetworking-3.0-Migration-Guide) for an overview of the architectural changes from 2.0.\n\n## Communication\n\n- If you **need help**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/afnetworking). (Tag 'afnetworking')\n- If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/afnetworking).\n- If you **found a bug**, _and can provide steps to reliably reproduce it_, open an issue.\n- If you **have a feature request**, open an issue.\n- If you **want to contribute**, submit a pull request.\n\n## Installation\nAFNetworking supports multiple methods for installing the library in a project.\n\n## Installation with CocoaPods\n\n[CocoaPods](http://cocoapods.org) is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like AFNetworking in your projects. See the [\"Getting Started\" guide for more information](https://github.com/AFNetworking/AFNetworking/wiki/Getting-Started-with-AFNetworking). You can install it with the following command:\n\n```bash\n$ gem install cocoapods\n```\n\n> CocoaPods 0.39.0+ is required to build AFNetworking 3.0.0+.\n\n#### Podfile\n\nTo integrate AFNetworking into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '8.0'\n\npod 'AFNetworking', '~> 3.0'\n```\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\n### Installation with Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.\n\nYou can install Carthage with [Homebrew](http://brew.sh/) using the following command:\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nTo integrate AFNetworking into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ogdl\ngithub \"AFNetworking/AFNetworking\" ~> 3.0\n```\n\nRun `carthage` to build the framework and drag the built `AFNetworking.framework` into your Xcode project.\n\n## Requirements\n\n| AFNetworking Version | Minimum iOS Target  | Minimum OS X Target  | Minimum watchOS Target  | Minimum tvOS Target  |                                   Notes                                   |\n|:--------------------:|:---------------------------:|:----------------------------:|:----------------------------:|:----------------------------:|:-------------------------------------------------------------------------:|\n| 3.x | iOS 7 | OS X 10.9 | watchOS 2.0 | tvOS 9.0 | Xcode 7+ is required. `NSURLConnectionOperation` support has been removed. |\n| 2.6 -> 2.6.3 | iOS 7 | OS X 10.9 | watchOS 2.0 | n/a | Xcode 7+ is required. |\n| 2.0 -> 2.5.4 | iOS 6 | OS X 10.8 | n/a | n/a | Xcode 5+ is required. `NSURLSession` subspec requires iOS 7 or OS X 10.9. |\n| 1.x | iOS 5 | Mac OS X 10.7 | n/a | n/a |\n| 0.10.x | iOS 4 | Mac OS X 10.6 | n/a | n/a |\n\n(OS X projects must support [64-bit with modern Cocoa runtime](https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtVersionsPlatforms.html)).\n\n> Programming in Swift? Try [Alamofire](https://github.com/Alamofire/Alamofire) for a more conventional set of APIs.\n\n## Architecture\n\n### NSURLSession\n\n- `AFURLSessionManager`\n- `AFHTTPSessionManager`\n\n### Serialization\n\n* `<AFURLRequestSerialization>`\n  - `AFHTTPRequestSerializer`\n  - `AFJSONRequestSerializer`\n  - `AFPropertyListRequestSerializer`\n* `<AFURLResponseSerialization>`\n  - `AFHTTPResponseSerializer`\n  - `AFJSONResponseSerializer`\n  - `AFXMLParserResponseSerializer`\n  - `AFXMLDocumentResponseSerializer` _(Mac OS X)_\n  - `AFPropertyListResponseSerializer`\n  - `AFImageResponseSerializer`\n  - `AFCompoundResponseSerializer`\n\n### Additional Functionality\n\n- `AFSecurityPolicy`\n- `AFNetworkReachabilityManager`\n\n## Usage\n\n### AFURLSessionManager\n\n`AFURLSessionManager` creates and manages an `NSURLSession` object based on a specified `NSURLSessionConfiguration` object, which conforms to `<NSURLSessionTaskDelegate>`, `<NSURLSessionDataDelegate>`, `<NSURLSessionDownloadDelegate>`, and `<NSURLSessionDelegate>`.\n\n#### Creating a Download Task\n\n```objective-c\nNSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];\nAFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];\n\nNSURL *URL = [NSURL URLWithString:@\"http://example.com/download.zip\"];\nNSURLRequest *request = [NSURLRequest requestWithURL:URL];\n\nNSURLSessionDownloadTask *downloadTask = [manager downloadTaskWithRequest:request progress:nil destination:^NSURL *(NSURL *targetPath, NSURLResponse *response) {\n    NSURL *documentsDirectoryURL = [[NSFileManager defaultManager] URLForDirectory:NSDocumentDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:NO error:nil];\n    return [documentsDirectoryURL URLByAppendingPathComponent:[response suggestedFilename]];\n} completionHandler:^(NSURLResponse *response, NSURL *filePath, NSError *error) {\n    NSLog(@\"File downloaded to: %@\", filePath);\n}];\n[downloadTask resume];\n```\n\n#### Creating an Upload Task\n\n```objective-c\nNSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];\nAFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];\n\nNSURL *URL = [NSURL URLWithString:@\"http://example.com/upload\"];\nNSURLRequest *request = [NSURLRequest requestWithURL:URL];\n\nNSURL *filePath = [NSURL fileURLWithPath:@\"file://path/to/image.png\"];\nNSURLSessionUploadTask *uploadTask = [manager uploadTaskWithRequest:request fromFile:filePath progress:nil completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {\n    if (error) {\n        NSLog(@\"Error: %@\", error);\n    } else {\n        NSLog(@\"Success: %@ %@\", response, responseObject);\n    }\n}];\n[uploadTask resume];\n```\n\n#### Creating an Upload Task for a Multi-Part Request, with Progress\n\n```objective-c\nNSMutableURLRequest *request = [[AFHTTPRequestSerializer serializer] multipartFormRequestWithMethod:@\"POST\" URLString:@\"http://example.com/upload\" parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {\n        [formData appendPartWithFileURL:[NSURL fileURLWithPath:@\"file://path/to/image.jpg\"] name:@\"file\" fileName:@\"filename.jpg\" mimeType:@\"image/jpeg\" error:nil];\n    } error:nil];\n\nAFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];\n\nNSURLSessionUploadTask *uploadTask;\nuploadTask = [manager\n              uploadTaskWithStreamedRequest:request\n              progress:^(NSProgress * _Nonnull uploadProgress) {\n                  // This is not called back on the main queue.\n                  // You are responsible for dispatching to the main queue for UI updates\n                  dispatch_async(dispatch_get_main_queue(), ^{\n                      //Update the progress view\n                      [progressView setProgress:uploadProgress.fractionCompleted];\n                  });\n              }\n              completionHandler:^(NSURLResponse * _Nonnull response, id  _Nullable responseObject, NSError * _Nullable error) {\n                  if (error) {\n                      NSLog(@\"Error: %@\", error);\n                  } else {\n                      NSLog(@\"%@ %@\", response, responseObject);\n                  }\n              }];\n\n[uploadTask resume];\n```\n\n#### Creating a Data Task\n\n```objective-c\nNSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];\nAFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];\n\nNSURL *URL = [NSURL URLWithString:@\"http://httpbin.org/get\"];\nNSURLRequest *request = [NSURLRequest requestWithURL:URL];\n\nNSURLSessionDataTask *dataTask = [manager dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {\n    if (error) {\n        NSLog(@\"Error: %@\", error);\n    } else {\n        NSLog(@\"%@ %@\", response, responseObject);\n    }\n}];\n[dataTask resume];\n```\n\n---\n\n### Request Serialization\n\nRequest serializers create requests from URL strings, encoding parameters as either a query string or HTTP body.\n\n```objective-c\nNSString *URLString = @\"http://example.com\";\nNSDictionary *parameters = @{@\"foo\": @\"bar\", @\"baz\": @[@1, @2, @3]};\n```\n\n#### Query String Parameter Encoding\n\n```objective-c\n[[AFHTTPRequestSerializer serializer] requestWithMethod:@\"GET\" URLString:URLString parameters:parameters error:nil];\n```\n\n    GET http://example.com?foo=bar&baz[]=1&baz[]=2&baz[]=3\n\n#### URL Form Parameter Encoding\n\n```objective-c\n[[AFHTTPRequestSerializer serializer] requestWithMethod:@\"POST\" URLString:URLString parameters:parameters error:nil];\n```\n\n    POST http://example.com/\n    Content-Type: application/x-www-form-urlencoded\n\n    foo=bar&baz[]=1&baz[]=2&baz[]=3\n\n#### JSON Parameter Encoding\n\n```objective-c\n[[AFJSONRequestSerializer serializer] requestWithMethod:@\"POST\" URLString:URLString parameters:parameters error:nil];\n```\n\n    POST http://example.com/\n    Content-Type: application/json\n\n    {\"foo\": \"bar\", \"baz\": [1,2,3]}\n\n---\n\n### Network Reachability Manager\n\n`AFNetworkReachabilityManager` monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces.\n\n* Do not use Reachability to determine if the original request should be sent.\n\t* You should try to send it.\n* You can use Reachability to determine when a request should be automatically retried.\n\t* Although it may still fail, a Reachability notification that the connectivity is available is a good time to retry something.\n* Network reachability is a useful tool for determining why a request might have failed.\n\t* After a network request has failed, telling the user they're offline is better than giving them a more technical but accurate error, such as \"request timed out.\"\n\nSee also [WWDC 2012 session 706, \"Networking Best Practices.\"](https://developer.apple.com/videos/play/wwdc2012-706/).\n\n#### Shared Network Reachability\n\n```objective-c\n[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {\n    NSLog(@\"Reachability: %@\", AFStringFromNetworkReachabilityStatus(status));\n}];\n\n[[AFNetworkReachabilityManager sharedManager] startMonitoring];\n```\n\n---\n\n### Security Policy\n\n`AFSecurityPolicy` evaluates server trust against pinned X.509 certificates and public keys over secure connections.\n\nAdding pinned SSL certificates to your app helps prevent man-in-the-middle attacks and other vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged to route all communication over an HTTPS connection with SSL pinning configured and enabled.\n\n#### Allowing Invalid SSL Certificates\n\n```objective-c\nAFHTTPSessionManager *manager = [AFHTTPSessionManager manager];\nmanager.securityPolicy.allowInvalidCertificates = YES; // not recommended for production\n```\n\n---\n\n## Unit Tests\n\nAFNetworking includes a suite of unit tests within the Tests subdirectory. These tests can be run simply be executed the test action on the platform framework you would like to test.\n\n## Credits\n\nAFNetworking is owned and maintained by the [Alamofire Software Foundation](http://alamofire.org).\n\nAFNetworking was originally created by [Scott Raymond](https://github.com/sco/) and [Mattt Thompson](https://github.com/mattt/) in the development of [Gowalla for iPhone](http://en.wikipedia.org/wiki/Gowalla).\n\nAFNetworking's logo was designed by [Alan Defibaugh](http://www.alandefibaugh.com/).\n\nAnd most of all, thanks to AFNetworking's [growing list of contributors](https://github.com/AFNetworking/AFNetworking/contributors).\n\n### Security Disclosure\n\nIf you believe you have identified a security vulnerability with AFNetworking, you should report it as soon as possible via email to security@alamofire.org. Please do not post it to a public issue tracker.\n\n## License\n\nAFNetworking is released under the MIT license. See LICENSE for details.\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.h",
    "content": "// AFAutoPurgingImageCache.h\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import <TargetConditionals.h>\n#import <Foundation/Foundation.h>\n\n#if TARGET_OS_IOS || TARGET_OS_TV\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n The `AFImageCache` protocol defines a set of APIs for adding, removing and fetching images from a cache synchronously.\n */\n@protocol AFImageCache <NSObject>\n\n/**\n Adds the image to the cache with the given identifier.\n\n @param image The image to cache.\n @param identifier The unique identifier for the image in the cache.\n */\n- (void)addImage:(UIImage *)image withIdentifier:(NSString *)identifier;\n\n/**\n Removes the image from the cache matching the given identifier.\n\n @param identifier The unique identifier for the image in the cache.\n\n @return A BOOL indicating whether or not the image was removed from the cache.\n */\n- (BOOL)removeImageWithIdentifier:(NSString *)identifier;\n\n/**\n Removes all images from the cache.\n\n @return A BOOL indicating whether or not all images were removed from the cache.\n */\n- (BOOL)removeAllImages;\n\n/**\n Returns the image in the cache associated with the given identifier.\n\n @param identifier The unique identifier for the image in the cache.\n\n @return An image for the matching identifier, or nil.\n */\n- (nullable UIImage *)imageWithIdentifier:(NSString *)identifier;\n@end\n\n\n/**\n The `ImageRequestCache` protocol extends the `ImageCache` protocol by adding methods for adding, removing and fetching images from a cache given an `NSURLRequest` and additional identifier.\n */\n@protocol AFImageRequestCache <AFImageCache>\n\n/**\n Adds the image to the cache using an identifier created from the request and additional identifier.\n\n @param image The image to cache.\n @param request The unique URL request identifing the image asset.\n @param identifier The additional identifier to apply to the URL request to identify the image.\n */\n- (void)addImage:(UIImage *)image forRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier;\n\n/**\n Removes the image from the cache using an identifier created from the request and additional identifier.\n\n @param request The unique URL request identifing the image asset.\n @param identifier The additional identifier to apply to the URL request to identify the image.\n \n @return A BOOL indicating whether or not all images were removed from the cache.\n */\n- (BOOL)removeImageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier;\n\n/**\n Returns the image from the cache associated with an identifier created from the request and additional identifier.\n\n @param request The unique URL request identifing the image asset.\n @param identifier The additional identifier to apply to the URL request to identify the image.\n\n @return An image for the matching request and identifier, or nil.\n */\n- (nullable UIImage *)imageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier;\n\n@end\n\n/**\n The `AutoPurgingImageCache` in an in-memory image cache used to store images up to a given memory capacity. When the memory capacity is reached, the image cache is sorted by last access date, then the oldest image is continuously purged until the preferred memory usage after purge is met. Each time an image is accessed through the cache, the internal access date of the image is updated.\n */\n@interface AFAutoPurgingImageCache : NSObject <AFImageRequestCache>\n\n/**\n The total memory capacity of the cache in bytes.\n */\n@property (nonatomic, assign) UInt64 memoryCapacity;\n\n/**\n The preferred memory usage after purge in bytes. During a purge, images will be purged until the memory capacity drops below this limit.\n */\n@property (nonatomic, assign) UInt64 preferredMemoryUsageAfterPurge;\n\n/**\n The current total memory usage in bytes of all images stored within the cache.\n */\n@property (nonatomic, assign, readonly) UInt64 memoryUsage;\n\n/**\n Initialies the `AutoPurgingImageCache` instance with default values for memory capacity and preferred memory usage after purge limit. `memoryCapcity` defaults to `100 MB`. `preferredMemoryUsageAfterPurge` defaults to `60 MB`.\n\n @return The new `AutoPurgingImageCache` instance.\n */\n- (instancetype)init;\n\n/**\n Initialies the `AutoPurgingImageCache` instance with the given memory capacity and preferred memory usage\n after purge limit.\n\n @param memoryCapacity The total memory capacity of the cache in bytes.\n @param preferredMemoryCapacity The preferred memory usage after purge in bytes.\n\n @return The new `AutoPurgingImageCache` instance.\n */\n- (instancetype)initWithMemoryCapacity:(UInt64)memoryCapacity preferredMemoryCapacity:(UInt64)preferredMemoryCapacity;\n\n@end\n\nNS_ASSUME_NONNULL_END\n\n#endif\n\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.m",
    "content": "// AFAutoPurgingImageCache.m\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import <TargetConditionals.h>\n\n#if TARGET_OS_IOS || TARGET_OS_TV \n\n#import \"AFAutoPurgingImageCache.h\"\n\n@interface AFCachedImage : NSObject\n\n@property (nonatomic, strong) UIImage *image;\n@property (nonatomic, strong) NSString *identifier;\n@property (nonatomic, assign) UInt64 totalBytes;\n@property (nonatomic, strong) NSDate *lastAccessDate;\n@property (nonatomic, assign) UInt64 currentMemoryUsage;\n\n@end\n\n@implementation AFCachedImage\n\n-(instancetype)initWithImage:(UIImage *)image identifier:(NSString *)identifier {\n    if (self = [self init]) {\n        self.image = image;\n        self.identifier = identifier;\n\n        CGSize imageSize = CGSizeMake(image.size.width * image.scale, image.size.height * image.scale);\n        CGFloat bytesPerPixel = 4.0;\n        CGFloat bytesPerSize = imageSize.width * imageSize.height;\n        self.totalBytes = (UInt64)bytesPerPixel * (UInt64)bytesPerSize;\n        self.lastAccessDate = [NSDate date];\n    }\n    return self;\n}\n\n- (UIImage*)accessImage {\n    self.lastAccessDate = [NSDate date];\n    return self.image;\n}\n\n- (NSString *)description {\n    NSString *descriptionString = [NSString stringWithFormat:@\"Idenfitier: %@  lastAccessDate: %@ \", self.identifier, self.lastAccessDate];\n    return descriptionString;\n\n}\n\n@end\n\n@interface AFAutoPurgingImageCache ()\n@property (nonatomic, strong) NSMutableDictionary <NSString* , AFCachedImage*> *cachedImages;\n@property (nonatomic, assign) UInt64 currentMemoryUsage;\n@property (nonatomic, strong) dispatch_queue_t synchronizationQueue;\n@end\n\n@implementation AFAutoPurgingImageCache\n\n- (instancetype)init {\n    return [self initWithMemoryCapacity:100 * 1024 * 1024 preferredMemoryCapacity:60 * 1024 * 1024];\n}\n\n- (instancetype)initWithMemoryCapacity:(UInt64)memoryCapacity preferredMemoryCapacity:(UInt64)preferredMemoryCapacity {\n    if (self = [super init]) {\n        self.memoryCapacity = memoryCapacity;\n        self.preferredMemoryUsageAfterPurge = preferredMemoryCapacity;\n        self.cachedImages = [[NSMutableDictionary alloc] init];\n\n        NSString *queueName = [NSString stringWithFormat:@\"com.alamofire.autopurgingimagecache-%@\", [[NSUUID UUID] UUIDString]];\n        self.synchronizationQueue = dispatch_queue_create([queueName cStringUsingEncoding:NSASCIIStringEncoding], DISPATCH_QUEUE_CONCURRENT);\n\n        [[NSNotificationCenter defaultCenter]\n         addObserver:self\n         selector:@selector(removeAllImages)\n         name:UIApplicationDidReceiveMemoryWarningNotification\n         object:nil];\n\n    }\n    return self;\n}\n\n- (void)dealloc {\n    [[NSNotificationCenter defaultCenter] removeObserver:self];\n}\n\n- (UInt64)memoryUsage {\n    __block UInt64 result = 0;\n    dispatch_sync(self.synchronizationQueue, ^{\n        result = self.currentMemoryUsage;\n    });\n    return result;\n}\n\n- (void)addImage:(UIImage *)image withIdentifier:(NSString *)identifier {\n    dispatch_barrier_async(self.synchronizationQueue, ^{\n        AFCachedImage *cacheImage = [[AFCachedImage alloc] initWithImage:image identifier:identifier];\n\n        AFCachedImage *previousCachedImage = self.cachedImages[identifier];\n        if (previousCachedImage != nil) {\n            self.currentMemoryUsage -= previousCachedImage.totalBytes;\n        }\n\n        self.cachedImages[identifier] = cacheImage;\n        self.currentMemoryUsage += cacheImage.totalBytes;\n    });\n\n    dispatch_barrier_async(self.synchronizationQueue, ^{\n        if (self.currentMemoryUsage > self.memoryCapacity) {\n            UInt64 bytesToPurge = self.currentMemoryUsage - self.preferredMemoryUsageAfterPurge;\n            NSMutableArray <AFCachedImage*> *sortedImages = [NSMutableArray arrayWithArray:self.cachedImages.allValues];\n            NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@\"lastAccessDate\"\n                                                                           ascending:YES];\n            [sortedImages sortUsingDescriptors:@[sortDescriptor]];\n\n            UInt64 bytesPurged = 0;\n\n            for (AFCachedImage *cachedImage in sortedImages) {\n                [self.cachedImages removeObjectForKey:cachedImage.identifier];\n                bytesPurged += cachedImage.totalBytes;\n                if (bytesPurged >= bytesToPurge) {\n                    break ;\n                }\n            }\n            self.currentMemoryUsage -= bytesPurged;\n        }\n    });\n}\n\n- (BOOL)removeImageWithIdentifier:(NSString *)identifier {\n    __block BOOL removed = NO;\n    dispatch_barrier_sync(self.synchronizationQueue, ^{\n        AFCachedImage *cachedImage = self.cachedImages[identifier];\n        if (cachedImage != nil) {\n            [self.cachedImages removeObjectForKey:identifier];\n            self.currentMemoryUsage -= cachedImage.totalBytes;\n            removed = YES;\n        }\n    });\n    return removed;\n}\n\n- (BOOL)removeAllImages {\n    __block BOOL removed = NO;\n    dispatch_barrier_sync(self.synchronizationQueue, ^{\n        if (self.cachedImages.count > 0) {\n            [self.cachedImages removeAllObjects];\n            self.currentMemoryUsage = 0;\n            removed = YES;\n        }\n    });\n    return removed;\n}\n\n- (nullable UIImage *)imageWithIdentifier:(NSString *)identifier {\n    __block UIImage *image = nil;\n    dispatch_sync(self.synchronizationQueue, ^{\n        AFCachedImage *cachedImage = self.cachedImages[identifier];\n        image = [cachedImage accessImage];\n    });\n    return image;\n}\n\n- (void)addImage:(UIImage *)image forRequest:(NSURLRequest *)request withAdditionalIdentifier:(NSString *)identifier {\n    [self addImage:image withIdentifier:[self imageCacheKeyFromURLRequest:request withAdditionalIdentifier:identifier]];\n}\n\n- (BOOL)removeImageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(NSString *)identifier {\n    return [self removeImageWithIdentifier:[self imageCacheKeyFromURLRequest:request withAdditionalIdentifier:identifier]];\n}\n\n- (nullable UIImage *)imageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(NSString *)identifier {\n    return [self imageWithIdentifier:[self imageCacheKeyFromURLRequest:request withAdditionalIdentifier:identifier]];\n}\n\n- (NSString *)imageCacheKeyFromURLRequest:(NSURLRequest *)request withAdditionalIdentifier:(NSString *)additionalIdentifier {\n    NSString *key = request.URL.absoluteString;\n    if (additionalIdentifier != nil) {\n        key = [key stringByAppendingString:additionalIdentifier];\n    }\n    return key;\n}\n\n@end\n\n#endif\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/UIKit+AFNetworking/AFImageDownloader.h",
    "content": "// AFImageDownloader.h\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import <TargetConditionals.h>\n\n#if TARGET_OS_IOS || TARGET_OS_TV \n\n#import <Foundation/Foundation.h>\n#import \"AFAutoPurgingImageCache.h\"\n#import \"AFHTTPSessionManager.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\ntypedef NS_ENUM(NSInteger, AFImageDownloadPrioritization) {\n    AFImageDownloadPrioritizationFIFO,\n    AFImageDownloadPrioritizationLIFO\n};\n\n/**\n The `AFImageDownloadReceipt` is an object vended by the `AFImageDownloader` when starting a data task. It can be used to cancel active tasks running on the `AFImageDownloader` session. As a general rule, image data tasks should be cancelled using the `AFImageDownloadReceipt` instead of calling `cancel` directly on the `task` itself. The `AFImageDownloader` is optimized to handle duplicate task scenarios as well as pending versus active downloads.\n */\n@interface AFImageDownloadReceipt : NSObject\n\n/**\n The data task created by the `AFImageDownloader`.\n*/\n@property (nonatomic, strong) NSURLSessionDataTask *task;\n\n/**\n The unique identifier for the success and failure blocks when duplicate requests are made.\n */\n@property (nonatomic, strong) NSUUID *receiptID;\n@end\n\n/** The `AFImageDownloader` class is responsible for downloading images in parallel on a prioritized queue. Incoming downloads are added to the front or back of the queue depending on the download prioritization. Each downloaded image is cached in the underlying `NSURLCache` as well as the in-memory image cache. By default, any download request with a cached image equivalent in the image cache will automatically be served the cached image representation.\n */\n@interface AFImageDownloader : NSObject\n\n/**\n The image cache used to store all downloaded images in. `AFAutoPurgingImageCache` by default.\n */\n@property (nonatomic, strong, nullable) id <AFImageRequestCache> imageCache;\n\n/**\n The `AFHTTPSessionManager` used to download images. By default, this is configured with an `AFImageResponseSerializer`, and a shared `NSURLCache` for all image downloads.\n */\n@property (nonatomic, strong) AFHTTPSessionManager *sessionManager;\n\n/**\n Defines the order prioritization of incoming download requests being inserted into the queue. `AFImageDownloadPrioritizationFIFO` by default.\n */\n@property (nonatomic, assign) AFImageDownloadPrioritization downloadPrioritizaton;\n\n/**\n The shared default instance of `AFImageDownloader` initialized with default values.\n */\n+ (instancetype)defaultInstance;\n\n/**\n Creates a default `NSURLCache` with common usage parameter values.\n\n @returns The default `NSURLCache` instance.\n */\n+ (NSURLCache *)defaultURLCache;\n\n/**\n Default initializer\n\n @return An instance of `AFImageDownloader` initialized with default values.\n */\n- (instancetype)init;\n\n/**\n Initializes the `AFImageDownloader` instance with the given session manager, download prioritization, maximum active download count and image cache.\n\n @param sessionManager The session manager to use to download images.\n @param downloadPrioritization The download prioritization of the download queue.\n @param maximumActiveDownloads  The maximum number of active downloads allowed at any given time. Recommend `4`.\n @param imageCache The image cache used to store all downloaded images in.\n\n @return The new `AFImageDownloader` instance.\n */\n- (instancetype)initWithSessionManager:(AFHTTPSessionManager *)sessionManager\n                downloadPrioritization:(AFImageDownloadPrioritization)downloadPrioritization\n                maximumActiveDownloads:(NSInteger)maximumActiveDownloads\n                            imageCache:(nullable id <AFImageRequestCache>)imageCache;\n\n/**\n Creates a data task using the `sessionManager` instance for the specified URL request.\n\n If the same data task is already in the queue or currently being downloaded, the success and failure blocks are\n appended to the already existing task. Once the task completes, all success or failure blocks attached to the\n task are executed in the order they were added.\n\n @param request The URL request.\n @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`.\n @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred.\n\n @return The image download receipt for the data task if available. `nil` if the image is stored in the cache.\n cache and the URL request cache policy allows the cache to be used.\n */\n- (nullable AFImageDownloadReceipt *)downloadImageForURLRequest:(NSURLRequest *)request\n                                                        success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse  * _Nullable response, UIImage *responseObject))success\n                                                        failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure;\n\n/**\n Creates a data task using the `sessionManager` instance for the specified URL request.\n\n If the same data task is already in the queue or currently being downloaded, the success and failure blocks are\n appended to the already existing task. Once the task completes, all success or failure blocks attached to the\n task are executed in the order they were added.\n\n @param request The URL request.\n @param receiptID The identifier to use for the download receipt that will be created for this request. This must be a unique identifier that does not represent any other request.\n @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`.\n @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred.\n\n @return The image download receipt for the data task if available. `nil` if the image is stored in the cache.\n cache and the URL request cache policy allows the cache to be used.\n */\n- (nullable AFImageDownloadReceipt *)downloadImageForURLRequest:(NSURLRequest *)request\n                                                 withReceiptID:(NSUUID *)receiptID\n                                                        success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse  * _Nullable response, UIImage *responseObject))success\n                                                        failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure;\n\n/**\n Cancels the data task in the receipt by removing the corresponding success and failure blocks and cancelling the data task if necessary.\n\n If the data task is pending in the queue, it will be cancelled if no other success and failure blocks are registered with the data task. If the data task is currently executing or is already completed, the success and failure blocks are removed and will not be called when the task finishes.\n\n @param imageDownloadReceipt The image download receipt to cancel.\n */\n- (void)cancelTaskForImageDownloadReceipt:(AFImageDownloadReceipt *)imageDownloadReceipt;\n\n@end\n\n#endif\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/UIKit+AFNetworking/AFImageDownloader.m",
    "content": "// AFImageDownloader.m\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import <TargetConditionals.h>\n\n#if TARGET_OS_IOS || TARGET_OS_TV\n\n#import \"AFImageDownloader.h\"\n#import \"AFHTTPSessionManager.h\"\n\n@interface AFImageDownloaderResponseHandler : NSObject\n@property (nonatomic, strong) NSUUID *uuid;\n@property (nonatomic, copy) void (^successBlock)(NSURLRequest*, NSHTTPURLResponse*, UIImage*);\n@property (nonatomic, copy) void (^failureBlock)(NSURLRequest*, NSHTTPURLResponse*, NSError*);\n@end\n\n@implementation AFImageDownloaderResponseHandler\n\n- (instancetype)initWithUUID:(NSUUID *)uuid\n                     success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *responseObject))success\n                     failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure {\n    if (self = [self init]) {\n        self.uuid = uuid;\n        self.successBlock = success;\n        self.failureBlock = failure;\n    }\n    return self;\n}\n\n- (NSString *)description {\n    return [NSString stringWithFormat: @\"<AFImageDownloaderResponseHandler>UUID: %@\", [self.uuid UUIDString]];\n}\n\n@end\n\n@interface AFImageDownloaderMergedTask : NSObject\n@property (nonatomic, strong) NSString *URLIdentifier;\n@property (nonatomic, strong) NSUUID *identifier;\n@property (nonatomic, strong) NSURLSessionDataTask *task;\n@property (nonatomic, strong) NSMutableArray <AFImageDownloaderResponseHandler*> *responseHandlers;\n\n@end\n\n@implementation AFImageDownloaderMergedTask\n\n- (instancetype)initWithURLIdentifier:(NSString *)URLIdentifier identifier:(NSUUID *)identifier task:(NSURLSessionDataTask *)task {\n    if (self = [self init]) {\n        self.URLIdentifier = URLIdentifier;\n        self.task = task;\n        self.identifier = identifier;\n        self.responseHandlers = [[NSMutableArray alloc] init];\n    }\n    return self;\n}\n\n- (void)addResponseHandler:(AFImageDownloaderResponseHandler*)handler {\n    [self.responseHandlers addObject:handler];\n}\n\n- (void)removeResponseHandler:(AFImageDownloaderResponseHandler*)handler {\n    [self.responseHandlers removeObject:handler];\n}\n\n@end\n\n@implementation AFImageDownloadReceipt\n\n- (instancetype)initWithReceiptID:(NSUUID *)receiptID task:(NSURLSessionDataTask *)task {\n    if (self = [self init]) {\n        self.receiptID = receiptID;\n        self.task = task;\n    }\n    return self;\n}\n\n@end\n\n@interface AFImageDownloader ()\n\n@property (nonatomic, strong) dispatch_queue_t synchronizationQueue;\n@property (nonatomic, strong) dispatch_queue_t responseQueue;\n\n@property (nonatomic, assign) NSInteger maximumActiveDownloads;\n@property (nonatomic, assign) NSInteger activeRequestCount;\n\n@property (nonatomic, strong) NSMutableArray *queuedMergedTasks;\n@property (nonatomic, strong) NSMutableDictionary *mergedTasks;\n\n@end\n\n\n@implementation AFImageDownloader\n\n+ (NSURLCache *)defaultURLCache {\n    return [[NSURLCache alloc] initWithMemoryCapacity:20 * 1024 * 1024\n                                         diskCapacity:150 * 1024 * 1024\n                                             diskPath:@\"com.alamofire.imagedownloader\"];\n}\n\n+ (NSURLSessionConfiguration *)defaultURLSessionConfiguration {\n    NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];\n\n    //TODO set the default HTTP headers\n\n    configuration.HTTPShouldSetCookies = YES;\n    configuration.HTTPShouldUsePipelining = NO;\n\n    configuration.requestCachePolicy = NSURLRequestUseProtocolCachePolicy;\n    configuration.allowsCellularAccess = YES;\n    configuration.timeoutIntervalForRequest = 60.0;\n    configuration.URLCache = [AFImageDownloader defaultURLCache];\n\n    return configuration;\n}\n\n- (instancetype)init {\n    NSURLSessionConfiguration *defaultConfiguration = [self.class defaultURLSessionConfiguration];\n    AFHTTPSessionManager *sessionManager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:defaultConfiguration];\n    sessionManager.responseSerializer = [AFImageResponseSerializer serializer];\n\n    return [self initWithSessionManager:sessionManager\n                 downloadPrioritization:AFImageDownloadPrioritizationFIFO\n                 maximumActiveDownloads:4\n                             imageCache:[[AFAutoPurgingImageCache alloc] init]];\n}\n\n- (instancetype)initWithSessionManager:(AFHTTPSessionManager *)sessionManager\n                downloadPrioritization:(AFImageDownloadPrioritization)downloadPrioritization\n                maximumActiveDownloads:(NSInteger)maximumActiveDownloads\n                            imageCache:(id <AFImageRequestCache>)imageCache {\n    if (self = [super init]) {\n        self.sessionManager = sessionManager;\n\n        self.downloadPrioritizaton = downloadPrioritization;\n        self.maximumActiveDownloads = maximumActiveDownloads;\n        self.imageCache = imageCache;\n\n        self.queuedMergedTasks = [[NSMutableArray alloc] init];\n        self.mergedTasks = [[NSMutableDictionary alloc] init];\n        self.activeRequestCount = 0;\n\n        NSString *name = [NSString stringWithFormat:@\"com.alamofire.imagedownloader.synchronizationqueue-%@\", [[NSUUID UUID] UUIDString]];\n        self.synchronizationQueue = dispatch_queue_create([name cStringUsingEncoding:NSASCIIStringEncoding], DISPATCH_QUEUE_SERIAL);\n\n        name = [NSString stringWithFormat:@\"com.alamofire.imagedownloader.responsequeue-%@\", [[NSUUID UUID] UUIDString]];\n        self.responseQueue = dispatch_queue_create([name cStringUsingEncoding:NSASCIIStringEncoding], DISPATCH_QUEUE_CONCURRENT);\n    }\n\n    return self;\n}\n\n+ (instancetype)defaultInstance {\n    static AFImageDownloader *sharedInstance = nil;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        sharedInstance = [[self alloc] init];\n    });\n    return sharedInstance;\n}\n\n- (nullable AFImageDownloadReceipt *)downloadImageForURLRequest:(NSURLRequest *)request\n                                                        success:(void (^)(NSURLRequest * _Nonnull, NSHTTPURLResponse * _Nullable, UIImage * _Nonnull))success\n                                                        failure:(void (^)(NSURLRequest * _Nonnull, NSHTTPURLResponse * _Nullable, NSError * _Nonnull))failure {\n    return [self downloadImageForURLRequest:request withReceiptID:[NSUUID UUID] success:success failure:failure];\n}\n\n- (nullable AFImageDownloadReceipt *)downloadImageForURLRequest:(NSURLRequest *)request\n                                                  withReceiptID:(nonnull NSUUID *)receiptID\n                                                        success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse  * _Nullable response, UIImage *responseObject))success\n                                                        failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure {\n    __block NSURLSessionDataTask *task = nil;\n    dispatch_sync(self.synchronizationQueue, ^{\n        NSString *URLIdentifier = request.URL.absoluteString;\n        if (URLIdentifier == nil) {\n            if (failure) {\n                NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorBadURL userInfo:nil];\n                dispatch_async(dispatch_get_main_queue(), ^{\n                    failure(request, nil, error);\n                });\n            }\n            return;\n        }\n\n        // 1) Append the success and failure blocks to a pre-existing request if it already exists\n        AFImageDownloaderMergedTask *existingMergedTask = self.mergedTasks[URLIdentifier];\n        if (existingMergedTask != nil) {\n            AFImageDownloaderResponseHandler *handler = [[AFImageDownloaderResponseHandler alloc] initWithUUID:receiptID success:success failure:failure];\n            [existingMergedTask addResponseHandler:handler];\n            task = existingMergedTask.task;\n            return;\n        }\n\n        // 2) Attempt to load the image from the image cache if the cache policy allows it\n        switch (request.cachePolicy) {\n            case NSURLRequestUseProtocolCachePolicy:\n            case NSURLRequestReturnCacheDataElseLoad:\n            case NSURLRequestReturnCacheDataDontLoad: {\n                UIImage *cachedImage = [self.imageCache imageforRequest:request withAdditionalIdentifier:nil];\n                if (cachedImage != nil) {\n                    if (success) {\n                        dispatch_async(dispatch_get_main_queue(), ^{\n                            success(request, nil, cachedImage);\n                        });\n                    }\n                    return;\n                }\n                break;\n            }\n            default:\n                break;\n        }\n\n        // 3) Create the request and set up authentication, validation and response serialization\n        NSUUID *mergedTaskIdentifier = [NSUUID UUID];\n        NSURLSessionDataTask *createdTask;\n        __weak __typeof__(self) weakSelf = self;\n\n        createdTask = [self.sessionManager\n                       dataTaskWithRequest:request\n                       completionHandler:^(NSURLResponse * _Nonnull response, id  _Nullable responseObject, NSError * _Nullable error) {\n                           dispatch_async(self.responseQueue, ^{\n                               __strong __typeof__(weakSelf) strongSelf = weakSelf;\n                               AFImageDownloaderMergedTask *mergedTask = self.mergedTasks[URLIdentifier];\n                               if ([mergedTask.identifier isEqual:mergedTaskIdentifier]) {\n                                   mergedTask = [strongSelf safelyRemoveMergedTaskWithURLIdentifier:URLIdentifier];\n                                   if (error) {\n                                       for (AFImageDownloaderResponseHandler *handler in mergedTask.responseHandlers) {\n                                           if (handler.failureBlock) {\n                                               dispatch_async(dispatch_get_main_queue(), ^{\n                                                   handler.failureBlock(request, (NSHTTPURLResponse*)response, error);\n                                               });\n                                           }\n                                       }\n                                   } else {\n                                       [strongSelf.imageCache addImage:responseObject forRequest:request withAdditionalIdentifier:nil];\n\n                                       for (AFImageDownloaderResponseHandler *handler in mergedTask.responseHandlers) {\n                                           if (handler.successBlock) {\n                                               dispatch_async(dispatch_get_main_queue(), ^{\n                                                   handler.successBlock(request, (NSHTTPURLResponse*)response, responseObject);\n                                               });\n                                           }\n                                       }\n                                       \n                                   }\n                               }\n                               [strongSelf safelyDecrementActiveTaskCount];\n                               [strongSelf safelyStartNextTaskIfNecessary];\n                           });\n                       }];\n\n        // 4) Store the response handler for use when the request completes\n        AFImageDownloaderResponseHandler *handler = [[AFImageDownloaderResponseHandler alloc] initWithUUID:receiptID\n                                                                                                   success:success\n                                                                                                   failure:failure];\n        AFImageDownloaderMergedTask *mergedTask = [[AFImageDownloaderMergedTask alloc]\n                                                   initWithURLIdentifier:URLIdentifier\n                                                   identifier:mergedTaskIdentifier\n                                                   task:createdTask];\n        [mergedTask addResponseHandler:handler];\n        self.mergedTasks[URLIdentifier] = mergedTask;\n\n        // 5) Either start the request or enqueue it depending on the current active request count\n        if ([self isActiveRequestCountBelowMaximumLimit]) {\n            [self startMergedTask:mergedTask];\n        } else {\n            [self enqueueMergedTask:mergedTask];\n        }\n\n        task = mergedTask.task;\n    });\n    if (task) {\n        return [[AFImageDownloadReceipt alloc] initWithReceiptID:receiptID task:task];\n    } else {\n        return nil;\n    }\n}\n\n- (void)cancelTaskForImageDownloadReceipt:(AFImageDownloadReceipt *)imageDownloadReceipt {\n    dispatch_sync(self.synchronizationQueue, ^{\n        NSString *URLIdentifier = imageDownloadReceipt.task.originalRequest.URL.absoluteString;\n        AFImageDownloaderMergedTask *mergedTask = self.mergedTasks[URLIdentifier];\n        NSUInteger index = [mergedTask.responseHandlers indexOfObjectPassingTest:^BOOL(AFImageDownloaderResponseHandler * _Nonnull handler, __unused NSUInteger idx, __unused BOOL * _Nonnull stop) {\n            return handler.uuid == imageDownloadReceipt.receiptID;\n        }];\n\n        if (index != NSNotFound) {\n            AFImageDownloaderResponseHandler *handler = mergedTask.responseHandlers[index];\n            [mergedTask removeResponseHandler:handler];\n            NSString *failureReason = [NSString stringWithFormat:@\"ImageDownloader cancelled URL request: %@\",imageDownloadReceipt.task.originalRequest.URL.absoluteString];\n            NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey:failureReason};\n            NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled userInfo:userInfo];\n            if (handler.failureBlock) {\n                dispatch_async(dispatch_get_main_queue(), ^{\n                    handler.failureBlock(imageDownloadReceipt.task.originalRequest, nil, error);\n                });\n            }\n        }\n\n        if (mergedTask.responseHandlers.count == 0 && mergedTask.task.state == NSURLSessionTaskStateSuspended) {\n            [mergedTask.task cancel];\n            [self removeMergedTaskWithURLIdentifier:URLIdentifier];\n        }\n    });\n}\n\n- (AFImageDownloaderMergedTask*)safelyRemoveMergedTaskWithURLIdentifier:(NSString *)URLIdentifier {\n    __block AFImageDownloaderMergedTask *mergedTask = nil;\n    dispatch_sync(self.synchronizationQueue, ^{\n        mergedTask = [self removeMergedTaskWithURLIdentifier:URLIdentifier];\n    });\n    return mergedTask;\n}\n\n//This method should only be called from safely within the synchronizationQueue\n- (AFImageDownloaderMergedTask *)removeMergedTaskWithURLIdentifier:(NSString *)URLIdentifier {\n    AFImageDownloaderMergedTask *mergedTask = self.mergedTasks[URLIdentifier];\n    [self.mergedTasks removeObjectForKey:URLIdentifier];\n    return mergedTask;\n}\n\n- (void)safelyDecrementActiveTaskCount {\n    dispatch_sync(self.synchronizationQueue, ^{\n        if (self.activeRequestCount > 0) {\n            self.activeRequestCount -= 1;\n        }\n    });\n}\n\n- (void)safelyStartNextTaskIfNecessary {\n    dispatch_sync(self.synchronizationQueue, ^{\n        if ([self isActiveRequestCountBelowMaximumLimit]) {\n            while (self.queuedMergedTasks.count > 0) {\n                AFImageDownloaderMergedTask *mergedTask = [self dequeueMergedTask];\n                if (mergedTask.task.state == NSURLSessionTaskStateSuspended) {\n                    [self startMergedTask:mergedTask];\n                    break;\n                }\n            }\n        }\n    });\n}\n\n- (void)startMergedTask:(AFImageDownloaderMergedTask *)mergedTask {\n    [mergedTask.task resume];\n    ++self.activeRequestCount;\n}\n\n- (void)enqueueMergedTask:(AFImageDownloaderMergedTask *)mergedTask {\n    switch (self.downloadPrioritizaton) {\n        case AFImageDownloadPrioritizationFIFO:\n            [self.queuedMergedTasks addObject:mergedTask];\n            break;\n        case AFImageDownloadPrioritizationLIFO:\n            [self.queuedMergedTasks insertObject:mergedTask atIndex:0];\n            break;\n    }\n}\n\n- (AFImageDownloaderMergedTask *)dequeueMergedTask {\n    AFImageDownloaderMergedTask *mergedTask = nil;\n    mergedTask = [self.queuedMergedTasks firstObject];\n    [self.queuedMergedTasks removeObject:mergedTask];\n    return mergedTask;\n}\n\n- (BOOL)isActiveRequestCountBelowMaximumLimit {\n    return self.activeRequestCount < self.maximumActiveDownloads;\n}\n\n@end\n\n#endif\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h",
    "content": "// AFNetworkActivityIndicatorManager.h\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import <Foundation/Foundation.h>\n\n#import <TargetConditionals.h>\n\n#if TARGET_OS_IOS\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n `AFNetworkActivityIndicatorManager` manages the state of the network activity indicator in the status bar. When enabled, it will listen for notifications indicating that a session task has started or finished, and start or stop animating the indicator accordingly. The number of active requests is incremented and decremented much like a stack or a semaphore, and the activity indicator will animate so long as that number is greater than zero.\n\n You should enable the shared instance of `AFNetworkActivityIndicatorManager` when your application finishes launching. In `AppDelegate application:didFinishLaunchingWithOptions:` you can do so with the following code:\n\n    [[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES];\n\n By setting `enabled` to `YES` for `sharedManager`, the network activity indicator will show and hide automatically as requests start and finish. You should not ever need to call `incrementActivityCount` or `decrementActivityCount` yourself.\n\n See the Apple Human Interface Guidelines section about the Network Activity Indicator for more information:\n http://developer.apple.com/library/iOS/#documentation/UserExperience/Conceptual/MobileHIG/UIElementGuidelines/UIElementGuidelines.html#//apple_ref/doc/uid/TP40006556-CH13-SW44\n */\nNS_EXTENSION_UNAVAILABLE_IOS(\"Use view controller based solutions where appropriate instead.\")\n@interface AFNetworkActivityIndicatorManager : NSObject\n\n/**\n A Boolean value indicating whether the manager is enabled.\n\n If YES, the manager will change status bar network activity indicator according to network operation notifications it receives. The default value is NO.\n */\n@property (nonatomic, assign, getter = isEnabled) BOOL enabled;\n\n/**\n A Boolean value indicating whether the network activity indicator manager is currently active.\n*/\n@property (readonly, nonatomic, assign, getter=isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible;\n\n/**\n A time interval indicating the minimum duration of networking activity that should occur before the activity indicator is displayed. The default value 1 second. If the network activity indicator should be displayed immediately when network activity occurs, this value should be set to 0 seconds.\n \n Apple's HIG describes the following:\n\n > Display the network activity indicator to provide feedback when your app accesses the network for more than a couple of seconds. If the operation finishes sooner than that, you don’t have to show the network activity indicator, because the indicator is likely to disappear before users notice its presence.\n\n */\n@property (nonatomic, assign) NSTimeInterval activationDelay;\n\n/**\n A time interval indicating the duration of time of no networking activity required before the activity indicator is disabled. This allows for continuous display of the network activity indicator across multiple requests. The default value is 0.17 seconds.\n */\n\n@property (nonatomic, assign) NSTimeInterval completionDelay;\n\n/**\n Returns the shared network activity indicator manager object for the system.\n\n @return The systemwide network activity indicator manager.\n */\n+ (instancetype)sharedManager;\n\n/**\n Increments the number of active network requests. If this number was zero before incrementing, this will start animating the status bar network activity indicator.\n */\n- (void)incrementActivityCount;\n\n/**\n Decrements the number of active network requests. If this number becomes zero after decrementing, this will stop animating the status bar network activity indicator.\n */\n- (void)decrementActivityCount;\n\n/**\n Set the a custom method to be executed when the network activity indicator manager should be hidden/shown. By default, this is null, and the UIApplication Network Activity Indicator will be managed automatically. If this block is set, it is the responsiblity of the caller to manager the network activity indicator going forward.\n\n @param block A block to be executed when the network activity indicator status changes.\n */\n- (void)setNetworkingActivityActionWithBlock:(nullable void (^)(BOOL networkActivityIndicatorVisible))block;\n\n@end\n\nNS_ASSUME_NONNULL_END\n\n#endif\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.m",
    "content": "// AFNetworkActivityIndicatorManager.m\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import \"AFNetworkActivityIndicatorManager.h\"\n\n#if TARGET_OS_IOS\n#import \"AFURLSessionManager.h\"\n\ntypedef NS_ENUM(NSInteger, AFNetworkActivityManagerState) {\n    AFNetworkActivityManagerStateNotActive,\n    AFNetworkActivityManagerStateDelayingStart,\n    AFNetworkActivityManagerStateActive,\n    AFNetworkActivityManagerStateDelayingEnd\n};\n\nstatic NSTimeInterval const kDefaultAFNetworkActivityManagerActivationDelay = 1.0;\nstatic NSTimeInterval const kDefaultAFNetworkActivityManagerCompletionDelay = 0.17;\n\nstatic NSURLRequest * AFNetworkRequestFromNotification(NSNotification *notification) {\n    if ([[notification object] respondsToSelector:@selector(originalRequest)]) {\n        return [(NSURLSessionTask *)[notification object] originalRequest];\n    } else {\n        return nil;\n    }\n}\n\ntypedef void (^AFNetworkActivityActionBlock)(BOOL networkActivityIndicatorVisible);\n\n@interface AFNetworkActivityIndicatorManager ()\n@property (readwrite, nonatomic, assign) NSInteger activityCount;\n@property (readwrite, nonatomic, strong) NSTimer *activationDelayTimer;\n@property (readwrite, nonatomic, strong) NSTimer *completionDelayTimer;\n@property (readonly, nonatomic, getter = isNetworkActivityOccurring) BOOL networkActivityOccurring;\n@property (nonatomic, copy) AFNetworkActivityActionBlock networkActivityActionBlock;\n@property (nonatomic, assign) AFNetworkActivityManagerState currentState;\n@property (nonatomic, assign, getter=isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible;\n\n- (void)updateCurrentStateForNetworkActivityChange;\n@end\n\n@implementation AFNetworkActivityIndicatorManager\n\n+ (instancetype)sharedManager {\n    static AFNetworkActivityIndicatorManager *_sharedManager = nil;\n    static dispatch_once_t oncePredicate;\n    dispatch_once(&oncePredicate, ^{\n        _sharedManager = [[self alloc] init];\n    });\n\n    return _sharedManager;\n}\n\n- (instancetype)init {\n    self = [super init];\n    if (!self) {\n        return nil;\n    }\n    self.currentState = AFNetworkActivityManagerStateNotActive;\n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidStart:) name:AFNetworkingTaskDidResumeNotification object:nil];\n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidFinish:) name:AFNetworkingTaskDidSuspendNotification object:nil];\n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidFinish:) name:AFNetworkingTaskDidCompleteNotification object:nil];\n    self.activationDelay = kDefaultAFNetworkActivityManagerActivationDelay;\n    self.completionDelay = kDefaultAFNetworkActivityManagerCompletionDelay;\n\n    return self;\n}\n\n- (void)dealloc {\n    [[NSNotificationCenter defaultCenter] removeObserver:self];\n\n    [_activationDelayTimer invalidate];\n    [_completionDelayTimer invalidate];\n}\n\n- (void)setEnabled:(BOOL)enabled {\n    _enabled = enabled;\n    if (enabled == NO) {\n        [self setCurrentState:AFNetworkActivityManagerStateNotActive];\n    }\n}\n\n- (void)setNetworkingActivityActionWithBlock:(void (^)(BOOL networkActivityIndicatorVisible))block {\n    self.networkActivityActionBlock = block;\n}\n\n- (BOOL)isNetworkActivityOccurring {\n    @synchronized(self) {\n        return self.activityCount > 0;\n    }\n}\n\n- (void)setNetworkActivityIndicatorVisible:(BOOL)networkActivityIndicatorVisible {\n    if (_networkActivityIndicatorVisible != networkActivityIndicatorVisible) {\n        [self willChangeValueForKey:@\"networkActivityIndicatorVisible\"];\n        @synchronized(self) {\n             _networkActivityIndicatorVisible = networkActivityIndicatorVisible;\n        }\n        [self didChangeValueForKey:@\"networkActivityIndicatorVisible\"];\n        if (self.networkActivityActionBlock) {\n            self.networkActivityActionBlock(networkActivityIndicatorVisible);\n        } else {\n            [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:networkActivityIndicatorVisible];\n        }\n    }\n}\n\n- (void)setActivityCount:(NSInteger)activityCount {\n\t@synchronized(self) {\n\t\t_activityCount = activityCount;\n\t}\n\n    dispatch_async(dispatch_get_main_queue(), ^{\n        [self updateCurrentStateForNetworkActivityChange];\n    });\n}\n\n- (void)incrementActivityCount {\n    [self willChangeValueForKey:@\"activityCount\"];\n\t@synchronized(self) {\n\t\t_activityCount++;\n\t}\n    [self didChangeValueForKey:@\"activityCount\"];\n\n    dispatch_async(dispatch_get_main_queue(), ^{\n        [self updateCurrentStateForNetworkActivityChange];\n    });\n}\n\n- (void)decrementActivityCount {\n    [self willChangeValueForKey:@\"activityCount\"];\n\t@synchronized(self) {\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wgnu\"\n\t\t_activityCount = MAX(_activityCount - 1, 0);\n#pragma clang diagnostic pop\n\t}\n    [self didChangeValueForKey:@\"activityCount\"];\n\n    dispatch_async(dispatch_get_main_queue(), ^{\n        [self updateCurrentStateForNetworkActivityChange];\n    });\n}\n\n- (void)networkRequestDidStart:(NSNotification *)notification {\n    if ([AFNetworkRequestFromNotification(notification) URL]) {\n        [self incrementActivityCount];\n    }\n}\n\n- (void)networkRequestDidFinish:(NSNotification *)notification {\n    if ([AFNetworkRequestFromNotification(notification) URL]) {\n        [self decrementActivityCount];\n    }\n}\n\n#pragma mark - Internal State Management\n- (void)setCurrentState:(AFNetworkActivityManagerState)currentState {\n    @synchronized(self) {\n        if (_currentState != currentState) {\n            [self willChangeValueForKey:@\"currentState\"];\n            _currentState = currentState;\n            switch (currentState) {\n                case AFNetworkActivityManagerStateNotActive:\n                    [self cancelActivationDelayTimer];\n                    [self cancelCompletionDelayTimer];\n                    [self setNetworkActivityIndicatorVisible:NO];\n                    break;\n                case AFNetworkActivityManagerStateDelayingStart:\n                    [self startActivationDelayTimer];\n                    break;\n                case AFNetworkActivityManagerStateActive:\n                    [self cancelCompletionDelayTimer];\n                    [self setNetworkActivityIndicatorVisible:YES];\n                    break;\n                case AFNetworkActivityManagerStateDelayingEnd:\n                    [self startCompletionDelayTimer];\n                    break;\n            }\n        }\n        [self didChangeValueForKey:@\"currentState\"];\n    }\n}\n\n- (void)updateCurrentStateForNetworkActivityChange {\n    if (self.enabled) {\n        switch (self.currentState) {\n            case AFNetworkActivityManagerStateNotActive:\n                if (self.isNetworkActivityOccurring) {\n                    [self setCurrentState:AFNetworkActivityManagerStateDelayingStart];\n                }\n                break;\n            case AFNetworkActivityManagerStateDelayingStart:\n                //No op. Let the delay timer finish out.\n                break;\n            case AFNetworkActivityManagerStateActive:\n                if (!self.isNetworkActivityOccurring) {\n                    [self setCurrentState:AFNetworkActivityManagerStateDelayingEnd];\n                }\n                break;\n            case AFNetworkActivityManagerStateDelayingEnd:\n                if (self.isNetworkActivityOccurring) {\n                    [self setCurrentState:AFNetworkActivityManagerStateActive];\n                }\n                break;\n        }\n    }\n}\n\n- (void)startActivationDelayTimer {\n    self.activationDelayTimer = [NSTimer\n                                 timerWithTimeInterval:self.activationDelay target:self selector:@selector(activationDelayTimerFired) userInfo:nil repeats:NO];\n    [[NSRunLoop mainRunLoop] addTimer:self.activationDelayTimer forMode:NSRunLoopCommonModes];\n}\n\n- (void)activationDelayTimerFired {\n    if (self.networkActivityOccurring) {\n        [self setCurrentState:AFNetworkActivityManagerStateActive];\n    } else {\n        [self setCurrentState:AFNetworkActivityManagerStateNotActive];\n    }\n}\n\n- (void)startCompletionDelayTimer {\n    [self.completionDelayTimer invalidate];\n    self.completionDelayTimer = [NSTimer timerWithTimeInterval:self.completionDelay target:self selector:@selector(completionDelayTimerFired) userInfo:nil repeats:NO];\n    [[NSRunLoop mainRunLoop] addTimer:self.completionDelayTimer forMode:NSRunLoopCommonModes];\n}\n\n- (void)completionDelayTimerFired {\n    [self setCurrentState:AFNetworkActivityManagerStateNotActive];\n}\n\n- (void)cancelActivationDelayTimer {\n    [self.activationDelayTimer invalidate];\n}\n\n- (void)cancelCompletionDelayTimer {\n    [self.completionDelayTimer invalidate];\n}\n\n@end\n\n#endif\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h",
    "content": "// UIActivityIndicatorView+AFNetworking.h\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import <Foundation/Foundation.h>\n\n#import <TargetConditionals.h>\n\n#if TARGET_OS_IOS || TARGET_OS_TV\n\n#import <UIKit/UIKit.h>\n\n/**\n This category adds methods to the UIKit framework's `UIActivityIndicatorView` class. The methods in this category provide support for automatically starting and stopping animation depending on the loading state of a session task.\n */\n@interface UIActivityIndicatorView (AFNetworking)\n\n///----------------------------------\n/// @name Animating for Session Tasks\n///----------------------------------\n\n/**\n Binds the animating state to the state of the specified task.\n\n @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled.\n */\n- (void)setAnimatingWithStateOfTask:(nullable NSURLSessionTask *)task;\n\n@end\n\n#endif\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.m",
    "content": "// UIActivityIndicatorView+AFNetworking.m\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import \"UIActivityIndicatorView+AFNetworking.h\"\n#import <objc/runtime.h>\n\n#if TARGET_OS_IOS || TARGET_OS_TV\n\n#import \"AFURLSessionManager.h\"\n\n@interface AFActivityIndicatorViewNotificationObserver : NSObject\n@property (readonly, nonatomic, weak) UIActivityIndicatorView *activityIndicatorView;\n- (instancetype)initWithActivityIndicatorView:(UIActivityIndicatorView *)activityIndicatorView;\n\n- (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task;\n\n@end\n\n@implementation UIActivityIndicatorView (AFNetworking)\n\n- (AFActivityIndicatorViewNotificationObserver *)af_notificationObserver {\n    AFActivityIndicatorViewNotificationObserver *notificationObserver = objc_getAssociatedObject(self, @selector(af_notificationObserver));\n    if (notificationObserver == nil) {\n        notificationObserver = [[AFActivityIndicatorViewNotificationObserver alloc] initWithActivityIndicatorView:self];\n        objc_setAssociatedObject(self, @selector(af_notificationObserver), notificationObserver, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n    }\n    return notificationObserver;\n}\n\n- (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task {\n    [[self af_notificationObserver] setAnimatingWithStateOfTask:task];\n}\n\n@end\n\n@implementation AFActivityIndicatorViewNotificationObserver\n\n- (instancetype)initWithActivityIndicatorView:(UIActivityIndicatorView *)activityIndicatorView\n{\n    self = [super init];\n    if (self) {\n        _activityIndicatorView = activityIndicatorView;\n    }\n    return self;\n}\n\n- (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task {\n    NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];\n\n    [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil];\n    [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil];\n    [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil];\n    \n    if (task) {\n        if (task.state != NSURLSessionTaskStateCompleted) {\n            \n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wreceiver-is-weak\"\n#pragma clang diagnostic ignored \"-Warc-repeated-use-of-weak\"\n            if (task.state == NSURLSessionTaskStateRunning) {\n                [self.activityIndicatorView startAnimating];\n            } else {\n                [self.activityIndicatorView stopAnimating];\n            }\n#pragma clang diagnostic pop\n\n            [notificationCenter addObserver:self selector:@selector(af_startAnimating) name:AFNetworkingTaskDidResumeNotification object:task];\n            [notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingTaskDidCompleteNotification object:task];\n            [notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingTaskDidSuspendNotification object:task];\n        }\n    }\n}\n\n#pragma mark -\n\n- (void)af_startAnimating {\n    dispatch_async(dispatch_get_main_queue(), ^{\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wreceiver-is-weak\"\n        [self.activityIndicatorView startAnimating];\n#pragma clang diagnostic pop\n    });\n}\n\n- (void)af_stopAnimating {\n    dispatch_async(dispatch_get_main_queue(), ^{\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wreceiver-is-weak\"\n        [self.activityIndicatorView stopAnimating];\n#pragma clang diagnostic pop\n    });\n}\n\n#pragma mark -\n\n- (void)dealloc {\n    NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];\n    \n    [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil];\n    [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil];\n    [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil];\n}\n\n@end\n\n#endif\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h",
    "content": "// UIButton+AFNetworking.h\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import <Foundation/Foundation.h>\n\n#import <TargetConditionals.h>\n\n#if TARGET_OS_IOS || TARGET_OS_TV\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@class AFImageDownloader;\n\n/**\n This category adds methods to the UIKit framework's `UIButton` class. The methods in this category provide support for loading remote images and background images asynchronously from a URL.\n\n @warning Compound values for control `state` (such as `UIControlStateHighlighted | UIControlStateDisabled`) are unsupported.\n */\n@interface UIButton (AFNetworking)\n\n///------------------------------------\n/// @name Accessing the Image Downloader\n///------------------------------------\n\n/**\n Set the shared image downloader used to download images.\n\n @param imageDownloader The shared image downloader used to download images.\n*/\n+ (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader;\n\n/**\n The shared image downloader used to download images.\n */\n+ (AFImageDownloader *)sharedImageDownloader;\n\n///--------------------\n/// @name Setting Image\n///--------------------\n\n/**\n Asynchronously downloads an image from the specified URL, and sets it as the image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled.\n\n  If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.\n\n @param state The control state.\n @param url The URL used for the image request.\n */\n- (void)setImageForState:(UIControlState)state\n                 withURL:(NSURL *)url;\n\n/**\n Asynchronously downloads an image from the specified URL, and sets it as the image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled.\n\n If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.\n\n @param state The control state.\n @param url The URL used for the image request.\n @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the button will not change its image until the image request finishes.\n */\n- (void)setImageForState:(UIControlState)state\n                 withURL:(NSURL *)url\n        placeholderImage:(nullable UIImage *)placeholderImage;\n\n/**\n Asynchronously downloads an image from the specified URL request, and sets it as the image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled.\n\n If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.\n\n If a success block is specified, it is the responsibility of the block to set the image of the button before returning. If no success block is specified, the default behavior of setting the image with `setImage:forState:` is applied.\n\n @param state The control state.\n @param urlRequest The URL request used for the image request.\n @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the button will not change its image until the image request finishes.\n @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`.\n @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred.\n */\n- (void)setImageForState:(UIControlState)state\n          withURLRequest:(NSURLRequest *)urlRequest\n        placeholderImage:(nullable UIImage *)placeholderImage\n                 success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success\n                 failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure;\n\n\n///-------------------------------\n/// @name Setting Background Image\n///-------------------------------\n\n/**\n Asynchronously downloads an image from the specified URL, and sets it as the background image for the specified state once the request is finished. Any previous background image request for the receiver will be cancelled.\n\n If the background image is cached locally, the background image is set immediately, otherwise the specified placeholder background image will be set immediately, and then the remote background image will be set once the request is finished.\n\n @param state The control state.\n @param url The URL used for the background image request.\n */\n- (void)setBackgroundImageForState:(UIControlState)state\n                           withURL:(NSURL *)url;\n\n/**\n Asynchronously downloads an image from the specified URL, and sets it as the background image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled.\n\n If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.\n\n @param state The control state.\n @param url The URL used for the background image request.\n @param placeholderImage The background image to be set initially, until the background image request finishes. If `nil`, the button will not change its background image until the background image request finishes.\n */\n- (void)setBackgroundImageForState:(UIControlState)state\n                           withURL:(NSURL *)url\n                  placeholderImage:(nullable UIImage *)placeholderImage;\n\n/**\n Asynchronously downloads an image from the specified URL request, and sets it as the image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled.\n\n If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.\n\n If a success block is specified, it is the responsibility of the block to set the image of the button before returning. If no success block is specified, the default behavior of setting the image with `setBackgroundImage:forState:` is applied.\n\n @param state The control state.\n @param urlRequest The URL request used for the image request.\n @param placeholderImage The background image to be set initially, until the background image request finishes. If `nil`, the button will not change its background image until the background image request finishes.\n @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`.\n @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred.\n */\n- (void)setBackgroundImageForState:(UIControlState)state\n                    withURLRequest:(NSURLRequest *)urlRequest\n                  placeholderImage:(nullable UIImage *)placeholderImage\n                           success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success\n                           failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure;\n\n\n///------------------------------\n/// @name Canceling Image Loading\n///------------------------------\n\n/**\n Cancels any executing image task for the specified control state of the receiver, if one exists.\n\n @param state The control state.\n */\n- (void)cancelImageDownloadTaskForState:(UIControlState)state;\n\n/**\n Cancels any executing background image task for the specified control state of the receiver, if one exists.\n\n @param state The control state.\n */\n- (void)cancelBackgroundImageDownloadTaskForState:(UIControlState)state;\n\n@end\n\nNS_ASSUME_NONNULL_END\n\n#endif\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.m",
    "content": "// UIButton+AFNetworking.m\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import \"UIButton+AFNetworking.h\"\n\n#import <objc/runtime.h>\n\n#if TARGET_OS_IOS || TARGET_OS_TV\n\n#import \"UIImageView+AFNetworking.h\"\n#import \"AFImageDownloader.h\"\n\n@interface UIButton (_AFNetworking)\n@end\n\n@implementation UIButton (_AFNetworking)\n\n#pragma mark -\n\nstatic char AFImageDownloadReceiptNormal;\nstatic char AFImageDownloadReceiptHighlighted;\nstatic char AFImageDownloadReceiptSelected;\nstatic char AFImageDownloadReceiptDisabled;\n\nstatic const char * af_imageDownloadReceiptKeyForState(UIControlState state) {\n    switch (state) {\n        case UIControlStateHighlighted:\n            return &AFImageDownloadReceiptHighlighted;\n        case UIControlStateSelected:\n            return &AFImageDownloadReceiptSelected;\n        case UIControlStateDisabled:\n            return &AFImageDownloadReceiptDisabled;\n        case UIControlStateNormal:\n        default:\n            return &AFImageDownloadReceiptNormal;\n    }\n}\n\n- (AFImageDownloadReceipt *)af_imageDownloadReceiptForState:(UIControlState)state {\n    return (AFImageDownloadReceipt *)objc_getAssociatedObject(self, af_imageDownloadReceiptKeyForState(state));\n}\n\n- (void)af_setImageDownloadReceipt:(AFImageDownloadReceipt *)imageDownloadReceipt\n                           forState:(UIControlState)state\n{\n    objc_setAssociatedObject(self, af_imageDownloadReceiptKeyForState(state), imageDownloadReceipt, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n#pragma mark -\n\nstatic char AFBackgroundImageDownloadReceiptNormal;\nstatic char AFBackgroundImageDownloadReceiptHighlighted;\nstatic char AFBackgroundImageDownloadReceiptSelected;\nstatic char AFBackgroundImageDownloadReceiptDisabled;\n\nstatic const char * af_backgroundImageDownloadReceiptKeyForState(UIControlState state) {\n    switch (state) {\n        case UIControlStateHighlighted:\n            return &AFBackgroundImageDownloadReceiptHighlighted;\n        case UIControlStateSelected:\n            return &AFBackgroundImageDownloadReceiptSelected;\n        case UIControlStateDisabled:\n            return &AFBackgroundImageDownloadReceiptDisabled;\n        case UIControlStateNormal:\n        default:\n            return &AFBackgroundImageDownloadReceiptNormal;\n    }\n}\n\n- (AFImageDownloadReceipt *)af_backgroundImageDownloadReceiptForState:(UIControlState)state {\n    return (AFImageDownloadReceipt *)objc_getAssociatedObject(self, af_backgroundImageDownloadReceiptKeyForState(state));\n}\n\n- (void)af_setBackgroundImageDownloadReceipt:(AFImageDownloadReceipt *)imageDownloadReceipt\n                                     forState:(UIControlState)state\n{\n    objc_setAssociatedObject(self, af_backgroundImageDownloadReceiptKeyForState(state), imageDownloadReceipt, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n@end\n\n#pragma mark -\n\n@implementation UIButton (AFNetworking)\n\n+ (AFImageDownloader *)sharedImageDownloader {\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wgnu\"\n    return objc_getAssociatedObject(self, @selector(sharedImageDownloader)) ?: [AFImageDownloader defaultInstance];\n#pragma clang diagnostic pop\n}\n\n+ (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader {\n    objc_setAssociatedObject(self, @selector(sharedImageDownloader), imageDownloader, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n#pragma mark -\n\n- (void)setImageForState:(UIControlState)state\n                 withURL:(NSURL *)url\n{\n    [self setImageForState:state withURL:url placeholderImage:nil];\n}\n\n- (void)setImageForState:(UIControlState)state\n                 withURL:(NSURL *)url\n        placeholderImage:(UIImage *)placeholderImage\n{\n    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];\n    [request addValue:@\"image/*\" forHTTPHeaderField:@\"Accept\"];\n\n    [self setImageForState:state withURLRequest:request placeholderImage:placeholderImage success:nil failure:nil];\n}\n\n- (void)setImageForState:(UIControlState)state\n          withURLRequest:(NSURLRequest *)urlRequest\n        placeholderImage:(nullable UIImage *)placeholderImage\n                 success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success\n                 failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure\n{\n    if ([self isActiveTaskURLEqualToURLRequest:urlRequest forState:state]) {\n        return;\n    }\n\n    [self cancelImageDownloadTaskForState:state];\n\n    AFImageDownloader *downloader = [[self class] sharedImageDownloader];\n    id <AFImageRequestCache> imageCache = downloader.imageCache;\n\n    //Use the image from the image cache if it exists\n    UIImage *cachedImage = [imageCache imageforRequest:urlRequest withAdditionalIdentifier:nil];\n    if (cachedImage) {\n        if (success) {\n            success(urlRequest, nil, cachedImage);\n        } else {\n            [self setImage:cachedImage forState:state];\n        }\n        [self af_setImageDownloadReceipt:nil forState:state];\n    } else {\n        if (placeholderImage) {\n            [self setImage:placeholderImage forState:state];\n        }\n\n        __weak __typeof(self)weakSelf = self;\n        NSUUID *downloadID = [NSUUID UUID];\n        AFImageDownloadReceipt *receipt;\n        receipt = [downloader\n                   downloadImageForURLRequest:urlRequest\n                   withReceiptID:downloadID\n                   success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) {\n                       __strong __typeof(weakSelf)strongSelf = weakSelf;\n                       if ([[strongSelf af_imageDownloadReceiptForState:state].receiptID isEqual:downloadID]) {\n                           if (success) {\n                               success(request, response, responseObject);\n                           } else if(responseObject) {\n                               [strongSelf setImage:responseObject forState:state];\n                           }\n                           [strongSelf af_setImageDownloadReceipt:nil forState:state];\n                       }\n\n                   }\n                   failure:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, NSError * _Nonnull error) {\n                       __strong __typeof(weakSelf)strongSelf = weakSelf;\n                       if ([[strongSelf af_imageDownloadReceiptForState:state].receiptID isEqual:downloadID]) {\n                           if (failure) {\n                               failure(request, response, error);\n                           }\n                           [strongSelf  af_setImageDownloadReceipt:nil forState:state];\n                       }\n                   }];\n\n        [self af_setImageDownloadReceipt:receipt forState:state];\n    }\n}\n\n#pragma mark -\n\n- (void)setBackgroundImageForState:(UIControlState)state\n                           withURL:(NSURL *)url\n{\n    [self setBackgroundImageForState:state withURL:url placeholderImage:nil];\n}\n\n- (void)setBackgroundImageForState:(UIControlState)state\n                           withURL:(NSURL *)url\n                  placeholderImage:(nullable UIImage *)placeholderImage\n{\n    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];\n    [request addValue:@\"image/*\" forHTTPHeaderField:@\"Accept\"];\n\n    [self setBackgroundImageForState:state withURLRequest:request placeholderImage:placeholderImage success:nil failure:nil];\n}\n\n- (void)setBackgroundImageForState:(UIControlState)state\n                    withURLRequest:(NSURLRequest *)urlRequest\n                  placeholderImage:(nullable UIImage *)placeholderImage\n                           success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success\n                           failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure\n{\n    if ([self isActiveBackgroundTaskURLEqualToURLRequest:urlRequest forState:state]) {\n        return;\n    }\n\n    [self cancelBackgroundImageDownloadTaskForState:state];\n\n    AFImageDownloader *downloader = [[self class] sharedImageDownloader];\n    id <AFImageRequestCache> imageCache = downloader.imageCache;\n\n    //Use the image from the image cache if it exists\n    UIImage *cachedImage = [imageCache imageforRequest:urlRequest withAdditionalIdentifier:nil];\n    if (cachedImage) {\n        if (success) {\n            success(urlRequest, nil, cachedImage);\n        } else {\n            [self setBackgroundImage:cachedImage forState:state];\n        }\n        [self af_setBackgroundImageDownloadReceipt:nil forState:state];\n    } else {\n        if (placeholderImage) {\n            [self setBackgroundImage:placeholderImage forState:state];\n        }\n\n        __weak __typeof(self)weakSelf = self;\n        NSUUID *downloadID = [NSUUID UUID];\n        AFImageDownloadReceipt *receipt;\n        receipt = [downloader\n                   downloadImageForURLRequest:urlRequest\n                   withReceiptID:downloadID\n                   success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) {\n                       __strong __typeof(weakSelf)strongSelf = weakSelf;\n                       if ([[strongSelf af_backgroundImageDownloadReceiptForState:state].receiptID isEqual:downloadID]) {\n                           if (success) {\n                               success(request, response, responseObject);\n                           } else if(responseObject) {\n                               [strongSelf setBackgroundImage:responseObject forState:state];\n                           }\n                           [strongSelf af_setBackgroundImageDownloadReceipt:nil forState:state];\n                       }\n\n                   }\n                   failure:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, NSError * _Nonnull error) {\n                       __strong __typeof(weakSelf)strongSelf = weakSelf;\n                       if ([[strongSelf af_backgroundImageDownloadReceiptForState:state].receiptID isEqual:downloadID]) {\n                           if (failure) {\n                               failure(request, response, error);\n                           }\n                           [strongSelf  af_setBackgroundImageDownloadReceipt:nil forState:state];\n                       }\n                   }];\n\n        [self af_setBackgroundImageDownloadReceipt:receipt forState:state];\n    }\n}\n\n#pragma mark -\n\n- (void)cancelImageDownloadTaskForState:(UIControlState)state {\n    AFImageDownloadReceipt *receipt = [self af_imageDownloadReceiptForState:state];\n    if (receipt != nil) {\n        [[self.class sharedImageDownloader] cancelTaskForImageDownloadReceipt:receipt];\n        [self af_setImageDownloadReceipt:nil forState:state];\n    }\n}\n\n- (void)cancelBackgroundImageDownloadTaskForState:(UIControlState)state {\n    AFImageDownloadReceipt *receipt = [self af_backgroundImageDownloadReceiptForState:state];\n    if (receipt != nil) {\n        [[self.class sharedImageDownloader] cancelTaskForImageDownloadReceipt:receipt];\n        [self af_setBackgroundImageDownloadReceipt:nil forState:state];\n    }\n}\n\n- (BOOL)isActiveTaskURLEqualToURLRequest:(NSURLRequest *)urlRequest forState:(UIControlState)state {\n    AFImageDownloadReceipt *receipt = [self af_imageDownloadReceiptForState:state];\n    return [receipt.task.originalRequest.URL.absoluteString isEqualToString:urlRequest.URL.absoluteString];\n}\n\n- (BOOL)isActiveBackgroundTaskURLEqualToURLRequest:(NSURLRequest *)urlRequest forState:(UIControlState)state {\n    AFImageDownloadReceipt *receipt = [self af_backgroundImageDownloadReceiptForState:state];\n    return [receipt.task.originalRequest.URL.absoluteString isEqualToString:urlRequest.URL.absoluteString];\n}\n\n\n@end\n\n#endif\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/UIKit+AFNetworking/UIImage+AFNetworking.h",
    "content": "//\n//  UIImage+AFNetworking.h\n//  \n//\n//  Created by Paulo Ferreira on 08/07/15.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#if TARGET_OS_IOS || TARGET_OS_TV\n\n#import <UIKit/UIKit.h>\n\n@interface UIImage (AFNetworking)\n\n+ (UIImage*) safeImageWithData:(NSData*)data;\n\n@end\n\n#endif\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h",
    "content": "// UIImageView+AFNetworking.h\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import <Foundation/Foundation.h>\n\n#import <TargetConditionals.h>\n\n#if TARGET_OS_IOS || TARGET_OS_TV\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@class AFImageDownloader;\n\n/**\n This category adds methods to the UIKit framework's `UIImageView` class. The methods in this category provide support for loading remote images asynchronously from a URL.\n */\n@interface UIImageView (AFNetworking)\n\n///------------------------------------\n/// @name Accessing the Image Downloader\n///------------------------------------\n\n/**\n Set the shared image downloader used to download images.\n\n @param imageDownloader The shared image downloader used to download images.\n */\n+ (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader;\n\n/**\n The shared image downloader used to download images.\n */\n+ (AFImageDownloader *)sharedImageDownloader;\n\n///--------------------\n/// @name Setting Image\n///--------------------\n\n/**\n Asynchronously downloads an image from the specified URL, and sets it once the request is finished. Any previous image request for the receiver will be cancelled.\n\n If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.\n\n By default, URL requests have a `Accept` header field value of \"image / *\", a cache policy of `NSURLCacheStorageAllowed` and a timeout interval of 30 seconds, and are set not handle cookies. To configure URL requests differently, use `setImageWithURLRequest:placeholderImage:success:failure:`\n\n @param url The URL used for the image request.\n */\n- (void)setImageWithURL:(NSURL *)url;\n\n/**\n Asynchronously downloads an image from the specified URL, and sets it once the request is finished. Any previous image request for the receiver will be cancelled.\n\n If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.\n\n By default, URL requests have a `Accept` header field value of \"image / *\", a cache policy of `NSURLCacheStorageAllowed` and a timeout interval of 30 seconds, and are set not handle cookies. To configure URL requests differently, use `setImageWithURLRequest:placeholderImage:success:failure:`\n\n @param url The URL used for the image request.\n @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes.\n */\n- (void)setImageWithURL:(NSURL *)url\n       placeholderImage:(nullable UIImage *)placeholderImage;\n\n/**\n Asynchronously downloads an image from the specified URL request, and sets it once the request is finished. Any previous image request for the receiver will be cancelled.\n\n If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.\n\n If a success block is specified, it is the responsibility of the block to set the image of the image view before returning. If no success block is specified, the default behavior of setting the image with `self.image = image` is applied.\n\n @param urlRequest The URL request used for the image request.\n @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes.\n @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`.\n @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred.\n */\n- (void)setImageWithURLRequest:(NSURLRequest *)urlRequest\n              placeholderImage:(nullable UIImage *)placeholderImage\n                       success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success\n                       failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure;\n\n/**\n Cancels any executing image operation for the receiver, if one exists.\n */\n- (void)cancelImageDownloadTask;\n\n@end\n\nNS_ASSUME_NONNULL_END\n\n#endif\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.m",
    "content": "// UIImageView+AFNetworking.m\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import \"UIImageView+AFNetworking.h\"\n\n#import <objc/runtime.h>\n\n#if TARGET_OS_IOS || TARGET_OS_TV\n\n#import \"AFImageDownloader.h\"\n\n@interface UIImageView (_AFNetworking)\n@property (readwrite, nonatomic, strong, setter = af_setActiveImageDownloadReceipt:) AFImageDownloadReceipt *af_activeImageDownloadReceipt;\n@end\n\n@implementation UIImageView (_AFNetworking)\n\n- (AFImageDownloadReceipt *)af_activeImageDownloadReceipt {\n    return (AFImageDownloadReceipt *)objc_getAssociatedObject(self, @selector(af_activeImageDownloadReceipt));\n}\n\n- (void)af_setActiveImageDownloadReceipt:(AFImageDownloadReceipt *)imageDownloadReceipt {\n    objc_setAssociatedObject(self, @selector(af_activeImageDownloadReceipt), imageDownloadReceipt, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n@end\n\n#pragma mark -\n\n@implementation UIImageView (AFNetworking)\n\n+ (AFImageDownloader *)sharedImageDownloader {\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wgnu\"\n    return objc_getAssociatedObject(self, @selector(sharedImageDownloader)) ?: [AFImageDownloader defaultInstance];\n#pragma clang diagnostic pop\n}\n\n+ (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader {\n    objc_setAssociatedObject(self, @selector(sharedImageDownloader), imageDownloader, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n#pragma mark -\n\n- (void)setImageWithURL:(NSURL *)url {\n    [self setImageWithURL:url placeholderImage:nil];\n}\n\n- (void)setImageWithURL:(NSURL *)url\n       placeholderImage:(UIImage *)placeholderImage\n{\n    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];\n    [request addValue:@\"image/*\" forHTTPHeaderField:@\"Accept\"];\n\n    [self setImageWithURLRequest:request placeholderImage:placeholderImage success:nil failure:nil];\n}\n\n- (void)setImageWithURLRequest:(NSURLRequest *)urlRequest\n              placeholderImage:(UIImage *)placeholderImage\n                       success:(void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success\n                       failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure\n{\n\n    if ([urlRequest URL] == nil) {\n        [self cancelImageDownloadTask];\n        self.image = placeholderImage;\n        return;\n    }\n\n    if ([self isActiveTaskURLEqualToURLRequest:urlRequest]){\n        return;\n    }\n\n    [self cancelImageDownloadTask];\n\n    AFImageDownloader *downloader = [[self class] sharedImageDownloader];\n    id <AFImageRequestCache> imageCache = downloader.imageCache;\n\n    //Use the image from the image cache if it exists\n    UIImage *cachedImage = [imageCache imageforRequest:urlRequest withAdditionalIdentifier:nil];\n    if (cachedImage) {\n        if (success) {\n            success(urlRequest, nil, cachedImage);\n        } else {\n            self.image = cachedImage;\n        }\n        [self clearActiveDownloadInformation];\n    } else {\n        if (placeholderImage) {\n            self.image = placeholderImage;\n        }\n\n        __weak __typeof(self)weakSelf = self;\n        NSUUID *downloadID = [NSUUID UUID];\n        AFImageDownloadReceipt *receipt;\n        receipt = [downloader\n                   downloadImageForURLRequest:urlRequest\n                   withReceiptID:downloadID\n                   success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) {\n                       __strong __typeof(weakSelf)strongSelf = weakSelf;\n                       if ([strongSelf.af_activeImageDownloadReceipt.receiptID isEqual:downloadID]) {\n                           if (success) {\n                               success(request, response, responseObject);\n                           } else if(responseObject) {\n                               strongSelf.image = responseObject;\n                           }\n                           [strongSelf clearActiveDownloadInformation];\n                       }\n\n                   }\n                   failure:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, NSError * _Nonnull error) {\n                       __strong __typeof(weakSelf)strongSelf = weakSelf;\n                        if ([strongSelf.af_activeImageDownloadReceipt.receiptID isEqual:downloadID]) {\n                            if (failure) {\n                                failure(request, response, error);\n                            }\n                            [strongSelf clearActiveDownloadInformation];\n                        }\n                   }];\n\n        self.af_activeImageDownloadReceipt = receipt;\n    }\n}\n\n- (void)cancelImageDownloadTask {\n    if (self.af_activeImageDownloadReceipt != nil) {\n        [[self.class sharedImageDownloader] cancelTaskForImageDownloadReceipt:self.af_activeImageDownloadReceipt];\n        [self clearActiveDownloadInformation];\n     }\n}\n\n- (void)clearActiveDownloadInformation {\n    self.af_activeImageDownloadReceipt = nil;\n}\n\n- (BOOL)isActiveTaskURLEqualToURLRequest:(NSURLRequest *)urlRequest {\n    return [self.af_activeImageDownloadReceipt.task.originalRequest.URL.absoluteString isEqualToString:urlRequest.URL.absoluteString];\n}\n\n@end\n\n#endif\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h",
    "content": "// UIKit+AFNetworking.h\n//\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#if TARGET_OS_IOS || TARGET_OS_TV\n#import <UIKit/UIKit.h>\n\n#ifndef _UIKIT_AFNETWORKING_\n    #define _UIKIT_AFNETWORKING_\n\n#if TARGET_OS_IOS\n    #import \"AFAutoPurgingImageCache.h\"\n    #import \"AFImageDownloader.h\"\n    #import \"AFNetworkActivityIndicatorManager.h\"\n    #import \"UIRefreshControl+AFNetworking.h\"\n    #import \"UIWebView+AFNetworking.h\"\n#endif\n\n    #import \"UIActivityIndicatorView+AFNetworking.h\"\n    #import \"UIButton+AFNetworking.h\"\n    #import \"UIImageView+AFNetworking.h\"\n    #import \"UIProgressView+AFNetworking.h\"\n#endif /* _UIKIT_AFNETWORKING_ */\n#endif\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h",
    "content": "// UIProgressView+AFNetworking.h\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import <Foundation/Foundation.h>\n\n#import <TargetConditionals.h>\n\n#if TARGET_OS_IOS || TARGET_OS_TV\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n\n/**\n This category adds methods to the UIKit framework's `UIProgressView` class. The methods in this category provide support for binding the progress to the upload and download progress of a session task.\n */\n@interface UIProgressView (AFNetworking)\n\n///------------------------------------\n/// @name Setting Session Task Progress\n///------------------------------------\n\n/**\n Binds the progress to the upload progress of the specified session task.\n\n @param task The session task.\n @param animated `YES` if the change should be animated, `NO` if the change should happen immediately.\n */\n- (void)setProgressWithUploadProgressOfTask:(NSURLSessionUploadTask *)task\n                                   animated:(BOOL)animated;\n\n/**\n Binds the progress to the download progress of the specified session task.\n\n @param task The session task.\n @param animated `YES` if the change should be animated, `NO` if the change should happen immediately.\n */\n- (void)setProgressWithDownloadProgressOfTask:(NSURLSessionDownloadTask *)task\n                                     animated:(BOOL)animated;\n\n@end\n\nNS_ASSUME_NONNULL_END\n\n#endif\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.m",
    "content": "// UIProgressView+AFNetworking.m\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import \"UIProgressView+AFNetworking.h\"\n\n#import <objc/runtime.h>\n\n#if TARGET_OS_IOS || TARGET_OS_TV\n\n#import \"AFURLSessionManager.h\"\n\nstatic void * AFTaskCountOfBytesSentContext = &AFTaskCountOfBytesSentContext;\nstatic void * AFTaskCountOfBytesReceivedContext = &AFTaskCountOfBytesReceivedContext;\n\n#pragma mark -\n\n@implementation UIProgressView (AFNetworking)\n\n- (BOOL)af_uploadProgressAnimated {\n    return [(NSNumber *)objc_getAssociatedObject(self, @selector(af_uploadProgressAnimated)) boolValue];\n}\n\n- (void)af_setUploadProgressAnimated:(BOOL)animated {\n    objc_setAssociatedObject(self, @selector(af_uploadProgressAnimated), @(animated), OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n- (BOOL)af_downloadProgressAnimated {\n    return [(NSNumber *)objc_getAssociatedObject(self, @selector(af_downloadProgressAnimated)) boolValue];\n}\n\n- (void)af_setDownloadProgressAnimated:(BOOL)animated {\n    objc_setAssociatedObject(self, @selector(af_downloadProgressAnimated), @(animated), OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n#pragma mark -\n\n- (void)setProgressWithUploadProgressOfTask:(NSURLSessionUploadTask *)task\n                                   animated:(BOOL)animated\n{\n    [task addObserver:self forKeyPath:@\"state\" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesSentContext];\n    [task addObserver:self forKeyPath:@\"countOfBytesSent\" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesSentContext];\n\n    [self af_setUploadProgressAnimated:animated];\n}\n\n- (void)setProgressWithDownloadProgressOfTask:(NSURLSessionDownloadTask *)task\n                                     animated:(BOOL)animated\n{\n    [task addObserver:self forKeyPath:@\"state\" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesReceivedContext];\n    [task addObserver:self forKeyPath:@\"countOfBytesReceived\" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesReceivedContext];\n\n    [self af_setDownloadProgressAnimated:animated];\n}\n\n#pragma mark - NSKeyValueObserving\n\n- (void)observeValueForKeyPath:(NSString *)keyPath\n                      ofObject:(id)object\n                        change:(__unused NSDictionary *)change\n                       context:(void *)context\n{\n    if (context == AFTaskCountOfBytesSentContext || context == AFTaskCountOfBytesReceivedContext) {\n        if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesSent))]) {\n            if ([object countOfBytesExpectedToSend] > 0) {\n                dispatch_async(dispatch_get_main_queue(), ^{\n                    [self setProgress:[object countOfBytesSent] / ([object countOfBytesExpectedToSend] * 1.0f) animated:self.af_uploadProgressAnimated];\n                });\n            }\n        }\n\n        if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesReceived))]) {\n            if ([object countOfBytesExpectedToReceive] > 0) {\n                dispatch_async(dispatch_get_main_queue(), ^{\n                    [self setProgress:[object countOfBytesReceived] / ([object countOfBytesExpectedToReceive] * 1.0f) animated:self.af_downloadProgressAnimated];\n                });\n            }\n        }\n\n        if ([keyPath isEqualToString:NSStringFromSelector(@selector(state))]) {\n            if ([(NSURLSessionTask *)object state] == NSURLSessionTaskStateCompleted) {\n                @try {\n                    [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(state))];\n\n                    if (context == AFTaskCountOfBytesSentContext) {\n                        [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesSent))];\n                    }\n\n                    if (context == AFTaskCountOfBytesReceivedContext) {\n                        [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesReceived))];\n                    }\n                }\n                @catch (NSException * __unused exception) {}\n            }\n        }\n    }\n}\n\n@end\n\n#endif\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h",
    "content": "// UIRefreshControl+AFNetworking.m\n//\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import <Foundation/Foundation.h>\n\n#import <TargetConditionals.h>\n\n#if TARGET_OS_IOS\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n This category adds methods to the UIKit framework's `UIRefreshControl` class. The methods in this category provide support for automatically beginning and ending refreshing depending on the loading state of a session task.\n */\n@interface UIRefreshControl (AFNetworking)\n\n///-----------------------------------\n/// @name Refreshing for Session Tasks\n///-----------------------------------\n\n/**\n Binds the refreshing state to the state of the specified task.\n \n @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled.\n */\n- (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task;\n\n@end\n\nNS_ASSUME_NONNULL_END\n\n#endif\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.m",
    "content": "// UIRefreshControl+AFNetworking.m\n//\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import \"UIRefreshControl+AFNetworking.h\"\n#import <objc/runtime.h>\n\n#if TARGET_OS_IOS\n\n#import \"AFURLSessionManager.h\"\n\n@interface AFRefreshControlNotificationObserver : NSObject\n@property (readonly, nonatomic, weak) UIRefreshControl *refreshControl;\n- (instancetype)initWithActivityRefreshControl:(UIRefreshControl *)refreshControl;\n\n- (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task;\n\n@end\n\n@implementation UIRefreshControl (AFNetworking)\n\n- (AFRefreshControlNotificationObserver *)af_notificationObserver {\n    AFRefreshControlNotificationObserver *notificationObserver = objc_getAssociatedObject(self, @selector(af_notificationObserver));\n    if (notificationObserver == nil) {\n        notificationObserver = [[AFRefreshControlNotificationObserver alloc] initWithActivityRefreshControl:self];\n        objc_setAssociatedObject(self, @selector(af_notificationObserver), notificationObserver, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n    }\n    return notificationObserver;\n}\n\n- (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task {\n    [[self af_notificationObserver] setRefreshingWithStateOfTask:task];\n}\n\n@end\n\n@implementation AFRefreshControlNotificationObserver\n\n- (instancetype)initWithActivityRefreshControl:(UIRefreshControl *)refreshControl\n{\n    self = [super init];\n    if (self) {\n        _refreshControl = refreshControl;\n    }\n    return self;\n}\n\n- (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task {\n    NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];\n\n    [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil];\n    [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil];\n    [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil];\n\n    if (task) {\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wreceiver-is-weak\"\n#pragma clang diagnostic ignored \"-Warc-repeated-use-of-weak\"\n        if (task.state == NSURLSessionTaskStateRunning) {\n            [self.refreshControl beginRefreshing];\n\n            [notificationCenter addObserver:self selector:@selector(af_beginRefreshing) name:AFNetworkingTaskDidResumeNotification object:task];\n            [notificationCenter addObserver:self selector:@selector(af_endRefreshing) name:AFNetworkingTaskDidCompleteNotification object:task];\n            [notificationCenter addObserver:self selector:@selector(af_endRefreshing) name:AFNetworkingTaskDidSuspendNotification object:task];\n        } else {\n            [self.refreshControl endRefreshing];\n        }\n#pragma clang diagnostic pop\n    }\n}\n\n#pragma mark -\n\n- (void)af_beginRefreshing {\n    dispatch_async(dispatch_get_main_queue(), ^{\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wreceiver-is-weak\"\n        [self.refreshControl beginRefreshing];\n#pragma clang diagnostic pop\n    });\n}\n\n- (void)af_endRefreshing {\n    dispatch_async(dispatch_get_main_queue(), ^{\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wreceiver-is-weak\"\n        [self.refreshControl endRefreshing];\n#pragma clang diagnostic pop\n    });\n}\n\n#pragma mark -\n\n- (void)dealloc {\n    NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];\n    \n    [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil];\n    [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil];\n    [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil];\n}\n\n@end\n\n#endif\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h",
    "content": "// UIWebView+AFNetworking.h\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import <Foundation/Foundation.h>\n\n#import <TargetConditionals.h>\n\n#if TARGET_OS_IOS\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@class AFHTTPSessionManager;\n\n/**\n This category adds methods to the UIKit framework's `UIWebView` class. The methods in this category provide increased control over the request cycle, including progress monitoring and success / failure handling.\n\n @discussion When using these category methods, make sure to assign `delegate` for the web view, which implements `–webView:shouldStartLoadWithRequest:navigationType:` appropriately. This allows for tapped links to be loaded through AFNetworking, and can ensure that `canGoBack` & `canGoForward` update their values correctly.\n */\n@interface UIWebView (AFNetworking)\n\n/**\n The session manager used to download all requests.\n */\n@property (nonatomic, strong) AFHTTPSessionManager *sessionManager;\n\n/**\n Asynchronously loads the specified request.\n\n @param request A URL request identifying the location of the content to load. This must not be `nil`.\n @param progress A progress object monitoring the current download progress.\n @param success A block object to be executed when the request finishes loading successfully. This block returns the HTML string to be loaded by the web view, and takes two arguments: the response, and the response string.\n @param failure A block object to be executed when the data task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error that occurred.\n */\n- (void)loadRequest:(NSURLRequest *)request\n           progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress\n            success:(nullable NSString * (^)(NSHTTPURLResponse *response, NSString *HTML))success\n            failure:(nullable void (^)(NSError *error))failure;\n\n/**\n Asynchronously loads the data associated with a particular request with a specified MIME type and text encoding.\n\n @param request A URL request identifying the location of the content to load. This must not be `nil`.\n @param MIMEType The MIME type of the content. Defaults to the content type of the response if not specified.\n @param textEncodingName The IANA encoding name, as in `utf-8` or `utf-16`. Defaults to the response text encoding if not specified.\n@param progress A progress object monitoring the current download progress.\n @param success A block object to be executed when the request finishes loading successfully. This block returns the data to be loaded by the web view and takes two arguments: the response, and the downloaded data.\n @param failure A block object to be executed when the data task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error that occurred.\n */\n- (void)loadRequest:(NSURLRequest *)request\n           MIMEType:(nullable NSString *)MIMEType\n   textEncodingName:(nullable NSString *)textEncodingName\n           progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress\n            success:(nullable NSData * (^)(NSHTTPURLResponse *response, NSData *data))success\n            failure:(nullable void (^)(NSError *error))failure;\n\n@end\n\nNS_ASSUME_NONNULL_END\n\n#endif\n"
  },
  {
    "path": "SJNetworkDemo/Pods/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.m",
    "content": "// UIWebView+AFNetworking.m\n// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import \"UIWebView+AFNetworking.h\"\n\n#import <objc/runtime.h>\n\n#if TARGET_OS_IOS\n\n#import \"AFHTTPSessionManager.h\"\n#import \"AFURLResponseSerialization.h\"\n#import \"AFURLRequestSerialization.h\"\n\n@interface UIWebView (_AFNetworking)\n@property (readwrite, nonatomic, strong, setter = af_setURLSessionTask:) NSURLSessionDataTask *af_URLSessionTask;\n@end\n\n@implementation UIWebView (_AFNetworking)\n\n- (NSURLSessionDataTask *)af_URLSessionTask {\n    return (NSURLSessionDataTask *)objc_getAssociatedObject(self, @selector(af_URLSessionTask));\n}\n\n- (void)af_setURLSessionTask:(NSURLSessionDataTask *)af_URLSessionTask {\n    objc_setAssociatedObject(self, @selector(af_URLSessionTask), af_URLSessionTask, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n@end\n\n#pragma mark -\n\n@implementation UIWebView (AFNetworking)\n\n- (AFHTTPSessionManager  *)sessionManager {\n    static AFHTTPSessionManager *_af_defaultHTTPSessionManager = nil;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        _af_defaultHTTPSessionManager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];\n        _af_defaultHTTPSessionManager.requestSerializer = [AFHTTPRequestSerializer serializer];\n        _af_defaultHTTPSessionManager.responseSerializer = [AFHTTPResponseSerializer serializer];\n    });\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wgnu\"\n    return objc_getAssociatedObject(self, @selector(sessionManager)) ?: _af_defaultHTTPSessionManager;\n#pragma clang diagnostic pop\n}\n\n- (void)setSessionManager:(AFHTTPSessionManager *)sessionManager {\n    objc_setAssociatedObject(self, @selector(sessionManager), sessionManager, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n- (AFHTTPResponseSerializer <AFURLResponseSerialization> *)responseSerializer {\n    static AFHTTPResponseSerializer <AFURLResponseSerialization> *_af_defaultResponseSerializer = nil;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        _af_defaultResponseSerializer = [AFHTTPResponseSerializer serializer];\n    });\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wgnu\"\n    return objc_getAssociatedObject(self, @selector(responseSerializer)) ?: _af_defaultResponseSerializer;\n#pragma clang diagnostic pop\n}\n\n- (void)setResponseSerializer:(AFHTTPResponseSerializer<AFURLResponseSerialization> *)responseSerializer {\n    objc_setAssociatedObject(self, @selector(responseSerializer), responseSerializer, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n#pragma mark -\n\n- (void)loadRequest:(NSURLRequest *)request\n           progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress\n            success:(NSString * (^)(NSHTTPURLResponse *response, NSString *HTML))success\n            failure:(void (^)(NSError *error))failure\n{\n    [self loadRequest:request MIMEType:nil textEncodingName:nil progress:progress success:^NSData *(NSHTTPURLResponse *response, NSData *data) {\n        NSStringEncoding stringEncoding = NSUTF8StringEncoding;\n        if (response.textEncodingName) {\n            CFStringEncoding encoding = CFStringConvertIANACharSetNameToEncoding((CFStringRef)response.textEncodingName);\n            if (encoding != kCFStringEncodingInvalidId) {\n                stringEncoding = CFStringConvertEncodingToNSStringEncoding(encoding);\n            }\n        }\n\n        NSString *string = [[NSString alloc] initWithData:data encoding:stringEncoding];\n        if (success) {\n            string = success(response, string);\n        }\n\n        return [string dataUsingEncoding:stringEncoding];\n    } failure:failure];\n}\n\n- (void)loadRequest:(NSURLRequest *)request\n           MIMEType:(NSString *)MIMEType\n   textEncodingName:(NSString *)textEncodingName\n           progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress\n            success:(NSData * (^)(NSHTTPURLResponse *response, NSData *data))success\n            failure:(void (^)(NSError *error))failure\n{\n    NSParameterAssert(request);\n\n    if (self.af_URLSessionTask.state == NSURLSessionTaskStateRunning || self.af_URLSessionTask.state == NSURLSessionTaskStateSuspended) {\n        [self.af_URLSessionTask cancel];\n    }\n    self.af_URLSessionTask = nil;\n\n    __weak __typeof(self)weakSelf = self;\n    NSURLSessionDataTask *dataTask;\n    dataTask = [self.sessionManager\n            GET:request.URL.absoluteString\n            parameters:nil\n            progress:nil\n            success:^(NSURLSessionDataTask * _Nonnull task, id  _Nonnull responseObject) {\n                __strong __typeof(weakSelf) strongSelf = weakSelf;\n                if (success) {\n                    success((NSHTTPURLResponse *)task.response, responseObject);\n                }\n                [strongSelf loadData:responseObject MIMEType:MIMEType textEncodingName:textEncodingName baseURL:[task.currentRequest URL]];\n\n                if ([strongSelf.delegate respondsToSelector:@selector(webViewDidStartLoad:)]) {\n                    [strongSelf.delegate webViewDidFinishLoad:strongSelf];\n                }\n            }\n            failure:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {\n                if (failure) {\n                    failure(error);\n                }\n            }];\n    self.af_URLSessionTask = dataTask;\n    if (progress != nil) {\n        *progress = [self.sessionManager downloadProgressForTask:dataTask];\n    }\n    [self.af_URLSessionTask resume];\n\n    if ([self.delegate respondsToSelector:@selector(webViewDidStartLoad:)]) {\n        [self.delegate webViewDidStartLoad:self];\n    }\n}\n\n@end\n\n#endif"
  },
  {
    "path": "SJNetworkDemo/Pods/Pods.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t0214246CCB1FF7182F7222B9CCDF8FCB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F921D275AC6AA48C031BF91FD4592584 /* Foundation.framework */; };\n\t\t1341A7AC2439CB63D459D32EF985A414 /* UIImage+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = C0DC8653B61F64B5FC03BFC2B0A6E528 /* UIImage+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t2579663181BFA8F7DA4B5D7CF8537FC0 /* UIActivityIndicatorView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D925E789318555435D0DBEF9BEC8015 /* UIActivityIndicatorView+AFNetworking.m */; };\n\t\t2EBAA518CB8B2DAF89A63637091D4615 /* UIButton+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = BFD303D6F6C659A55A8684008D1476CB /* UIButton+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t31ED9BD97AF9E62874AF3CDF2F8090CF /* AFNetworkActivityIndicatorManager.m in Sources */ = {isa = PBXBuildFile; fileRef = FE9DC137B1B02C802E7ABBECC9401A7B /* AFNetworkActivityIndicatorManager.m */; };\n\t\t46401F3C7FF0B0CFE2E9B14914780835 /* AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = E71FC5436C29FCEB72394E7117726B8F /* AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5719F06B809080CDEF7E6BC75DEA1A3C /* UIKit+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 20CB1302DD85B80CBADE42E436CF5930 /* UIKit+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5945033488F9995134DBB7014DE2412F /* AFURLRequestSerialization.m in Sources */ = {isa = PBXBuildFile; fileRef = D2792B01BCFFB8C68B0CE56421B99A2F /* AFURLRequestSerialization.m */; };\n\t\t5C0696B2AD1DC23F6473F5A19FAB6296 /* AFImageDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 8006E5A6F0951AA637FFA7F53DBA00D9 /* AFImageDownloader.m */; };\n\t\t66635EAAE52FF5571DBCDC626FB8CA86 /* AFURLResponseSerialization.h in Headers */ = {isa = PBXBuildFile; fileRef = 8946DE00AC08571F0D4A4F985A8FA609 /* AFURLResponseSerialization.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t66E1040543AF7BA3DC3731FE17C85F5B /* AFSecurityPolicy.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B8C2F3F38AC8B05D07C9BAACD044EAD /* AFSecurityPolicy.m */; };\n\t\t682B0E603612B6ADBCCF30580F9A4B09 /* UIActivityIndicatorView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = E451FBBEE5D302A74D966AC502CE5B19 /* UIActivityIndicatorView+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t6B71CE5BA32574F407349C1DA20605B4 /* AFHTTPSessionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 42C03FCF30AB48A3B8DC805A289477E2 /* AFHTTPSessionManager.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t707E818332E5033501DF2D7826C639DF /* AFImageDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 8B17FF80B117EDDFBD41C5C3B5C1D217 /* AFImageDownloader.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t73811DA312BCB537D44D62EC6AD15766 /* AFHTTPSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 42EAD270211F301E809EA7C39D05A3DC /* AFHTTPSessionManager.m */; };\n\t\t775CE7A8107457BDE59F113D40020839 /* AFAutoPurgingImageCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 1246CB48952FF37C1DB54894C46F6390 /* AFAutoPurgingImageCache.m */; };\n\t\t85D30678FF4F0AB306399A368EAA46B2 /* AFURLResponseSerialization.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E990D35FEF51D7420F303E35DCBE1F6 /* AFURLResponseSerialization.m */; };\n\t\t8958F2453EEBAF71BFEBD78FB48986EC /* UIWebView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 036FDD48539129C05AAE4C9ACA312100 /* UIWebView+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t903158692A045396106CA22C0DD13BA6 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EC8A7C0B6179467051ED95E59DB2AF9F /* SystemConfiguration.framework */; };\n\t\t97A86FAAD4B1AD9B3292FF6AF1D8F82B /* AFNetworking-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 14F2B0D3DD13B76429F713F1F1A1CC6F /* AFNetworking-dummy.m */; };\n\t\t9F5BB6B4995BA4A3B2C6AEBA6C31A6DB /* AFURLSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 809E0EE6429DA2700D30D5F8F46F4100 /* AFURLSessionManager.m */; };\n\t\tA10762E25BF68C0C03081C7D5906CE4D /* Pods-SJNetworkingDemo-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 3049B48EF8F1C0E188C2ABC513E28E3A /* Pods-SJNetworkingDemo-dummy.m */; };\n\t\tA277AD9070E44BED5A7DE0B1D64D6F15 /* UIImageView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 0E9837C7FFCFC4203B1BAADAADD8E206 /* UIImageView+AFNetworking.m */; };\n\t\tA7F7FDCD36E2DD8D8E346DB19452CC03 /* UIWebView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 51204DFB5BF601D556D71C3736263351 /* UIWebView+AFNetworking.m */; };\n\t\tB40756412613B53C80EE77C4C223990F /* UIProgressView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 1207584E6BDCF4C846A1DDFE0BCFEECF /* UIProgressView+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tB84CD33084C9867E67BD56E47B7BFC04 /* UIRefreshControl+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = CC618B900858F4F77C2746363E77B86C /* UIRefreshControl+AFNetworking.m */; };\n\t\tC1C0D7C93BF3DE14A26757273598D0FA /* AFURLRequestSerialization.h in Headers */ = {isa = PBXBuildFile; fileRef = 18B9DCDB5BE79C17D786D046D23A6C8F /* AFURLRequestSerialization.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tCBCCEAD402645565401CA93924736979 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A64716173FC0305057230E14CDCC7A77 /* CoreGraphics.framework */; };\n\t\tD10CC46035F7A0C868C0955664A34609 /* UIButton+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 516F3F2A9B24B2E2092E84E8EAF0A9F7 /* UIButton+AFNetworking.m */; };\n\t\tD4AA4704CA7863CC86E22AAF88635836 /* UIProgressView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F90194E52430599383549278FEA918 /* UIProgressView+AFNetworking.m */; };\n\t\tD59FC98A74E440C4725B6FDC28F5951E /* AFSecurityPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 0401DF9E61B17C3AE9FE93347CCD9E64 /* AFSecurityPolicy.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tD5CB999FB5FC80FC126A38AB4DF12227 /* UIImageView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = C23C3983ADC1EBC0A6AD3D68F3DBC4BA /* UIImageView+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tDE31BBF6A7963C5871A19655EF5532BE /* AFNetworkReachabilityManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 357FC25AA9F2E82213C986CE50969E1A /* AFNetworkReachabilityManager.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tDE825B8F32AB823F4BE5492CAC6FCB4B /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 12A9374C39A6EFA90AD3F2E64799ECC5 /* Security.framework */; };\n\t\tE0EF330DB2D3521ED26E67B2E8687A2E /* AFNetworkReachabilityManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 4852ABEFD7FFFAE072C5835CCDB22279 /* AFNetworkReachabilityManager.m */; };\n\t\tE5EA3FA0ADD052B6A897467C05845B71 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F921D275AC6AA48C031BF91FD4592584 /* Foundation.framework */; };\n\t\tE7B0270BEDCBE116DDD853F76E27B0BA /* AFNetworkActivityIndicatorManager.h in Headers */ = {isa = PBXBuildFile; fileRef = AFF2CC19E35B6A289DF5C325A6C2B4E7 /* AFNetworkActivityIndicatorManager.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tF099E5987DD80E8D78E909AF81D3C587 /* UIRefreshControl+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 78C774AEA3474BF09AD285C28E701D5F /* UIRefreshControl+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tF1F93EE1AA5E870F2CE81325CE9EB643 /* AFAutoPurgingImageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 18A6CC7151721E485930D715056633ED /* AFAutoPurgingImageCache.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tF5CC06F3E0C232483A72DCCFAF393BE0 /* AFURLSessionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 525066ED64B26EC45F9B2AD4D3B0D1B2 /* AFURLSessionManager.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tF8DCA6C3C05A59B2C95A1B5F1CBD8C99 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B9FDBCCB266ACFED93E55656FD8A014C /* MobileCoreServices.framework */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\tD6013EEAD8842F3CE01C0268E3D15430 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 9E033EDB5EC0819481B0546434FA577B;\n\t\t\tremoteInfo = AFNetworking;\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXFileReference section */\n\t\t036FDD48539129C05AAE4C9ACA312100 /* UIWebView+AFNetworking.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIWebView+AFNetworking.h\"; path = \"UIKit+AFNetworking/UIWebView+AFNetworking.h\"; sourceTree = \"<group>\"; };\n\t\t0401DF9E61B17C3AE9FE93347CCD9E64 /* AFSecurityPolicy.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AFSecurityPolicy.h; path = AFNetworking/AFSecurityPolicy.h; sourceTree = \"<group>\"; };\n\t\t0E9837C7FFCFC4203B1BAADAADD8E206 /* UIImageView+AFNetworking.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIImageView+AFNetworking.m\"; path = \"UIKit+AFNetworking/UIImageView+AFNetworking.m\"; sourceTree = \"<group>\"; };\n\t\t1207584E6BDCF4C846A1DDFE0BCFEECF /* UIProgressView+AFNetworking.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIProgressView+AFNetworking.h\"; path = \"UIKit+AFNetworking/UIProgressView+AFNetworking.h\"; sourceTree = \"<group>\"; };\n\t\t1246CB48952FF37C1DB54894C46F6390 /* AFAutoPurgingImageCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = AFAutoPurgingImageCache.m; path = \"UIKit+AFNetworking/AFAutoPurgingImageCache.m\"; sourceTree = \"<group>\"; };\n\t\t12A9374C39A6EFA90AD3F2E64799ECC5 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/Security.framework; sourceTree = DEVELOPER_DIR; };\n\t\t14673F01BA2ED5D126E93E99A45B2088 /* AFNetworking-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"AFNetworking-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\t14F2B0D3DD13B76429F713F1F1A1CC6F /* AFNetworking-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"AFNetworking-dummy.m\"; sourceTree = \"<group>\"; };\n\t\t160CC776F085040F2BB1774841D86F45 /* Pods-SJNetworkingDemo-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = \"Pods-SJNetworkingDemo-acknowledgements.markdown\"; sourceTree = \"<group>\"; };\n\t\t18A6CC7151721E485930D715056633ED /* AFAutoPurgingImageCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AFAutoPurgingImageCache.h; path = \"UIKit+AFNetworking/AFAutoPurgingImageCache.h\"; sourceTree = \"<group>\"; };\n\t\t18B9DCDB5BE79C17D786D046D23A6C8F /* AFURLRequestSerialization.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AFURLRequestSerialization.h; path = AFNetworking/AFURLRequestSerialization.h; sourceTree = \"<group>\"; };\n\t\t1E990D35FEF51D7420F303E35DCBE1F6 /* AFURLResponseSerialization.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = AFURLResponseSerialization.m; path = AFNetworking/AFURLResponseSerialization.m; sourceTree = \"<group>\"; };\n\t\t20CB1302DD85B80CBADE42E436CF5930 /* UIKit+AFNetworking.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIKit+AFNetworking.h\"; path = \"UIKit+AFNetworking/UIKit+AFNetworking.h\"; sourceTree = \"<group>\"; };\n\t\t3049B48EF8F1C0E188C2ABC513E28E3A /* Pods-SJNetworkingDemo-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"Pods-SJNetworkingDemo-dummy.m\"; sourceTree = \"<group>\"; };\n\t\t357FC25AA9F2E82213C986CE50969E1A /* AFNetworkReachabilityManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AFNetworkReachabilityManager.h; path = AFNetworking/AFNetworkReachabilityManager.h; sourceTree = \"<group>\"; };\n\t\t3B171D29EF26E7837600FD517F97B50B /* Pods-SJNetworkingDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = \"Pods-SJNetworkingDemo.debug.xcconfig\"; sourceTree = \"<group>\"; };\n\t\t3B8C2F3F38AC8B05D07C9BAACD044EAD /* AFSecurityPolicy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = AFSecurityPolicy.m; path = AFNetworking/AFSecurityPolicy.m; sourceTree = \"<group>\"; };\n\t\t42C03FCF30AB48A3B8DC805A289477E2 /* AFHTTPSessionManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AFHTTPSessionManager.h; path = AFNetworking/AFHTTPSessionManager.h; sourceTree = \"<group>\"; };\n\t\t42EAD270211F301E809EA7C39D05A3DC /* AFHTTPSessionManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = AFHTTPSessionManager.m; path = AFNetworking/AFHTTPSessionManager.m; sourceTree = \"<group>\"; };\n\t\t4852ABEFD7FFFAE072C5835CCDB22279 /* AFNetworkReachabilityManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = AFNetworkReachabilityManager.m; path = AFNetworking/AFNetworkReachabilityManager.m; sourceTree = \"<group>\"; };\n\t\t4D925E789318555435D0DBEF9BEC8015 /* UIActivityIndicatorView+AFNetworking.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIActivityIndicatorView+AFNetworking.m\"; path = \"UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.m\"; sourceTree = \"<group>\"; };\n\t\t51204DFB5BF601D556D71C3736263351 /* UIWebView+AFNetworking.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIWebView+AFNetworking.m\"; path = \"UIKit+AFNetworking/UIWebView+AFNetworking.m\"; sourceTree = \"<group>\"; };\n\t\t516F3F2A9B24B2E2092E84E8EAF0A9F7 /* UIButton+AFNetworking.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIButton+AFNetworking.m\"; path = \"UIKit+AFNetworking/UIButton+AFNetworking.m\"; sourceTree = \"<group>\"; };\n\t\t525066ED64B26EC45F9B2AD4D3B0D1B2 /* AFURLSessionManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AFURLSessionManager.h; path = AFNetworking/AFURLSessionManager.h; sourceTree = \"<group>\"; };\n\t\t78C774AEA3474BF09AD285C28E701D5F /* UIRefreshControl+AFNetworking.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIRefreshControl+AFNetworking.h\"; path = \"UIKit+AFNetworking/UIRefreshControl+AFNetworking.h\"; sourceTree = \"<group>\"; };\n\t\t8006E5A6F0951AA637FFA7F53DBA00D9 /* AFImageDownloader.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = AFImageDownloader.m; path = \"UIKit+AFNetworking/AFImageDownloader.m\"; sourceTree = \"<group>\"; };\n\t\t809E0EE6429DA2700D30D5F8F46F4100 /* AFURLSessionManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = AFURLSessionManager.m; path = AFNetworking/AFURLSessionManager.m; sourceTree = \"<group>\"; };\n\t\t81878840D53F53CA43E24C220CA96467 /* Pods-SJNetworkingDemo-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"Pods-SJNetworkingDemo-acknowledgements.plist\"; sourceTree = \"<group>\"; };\n\t\t8946DE00AC08571F0D4A4F985A8FA609 /* AFURLResponseSerialization.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AFURLResponseSerialization.h; path = AFNetworking/AFURLResponseSerialization.h; sourceTree = \"<group>\"; };\n\t\t8B17FF80B117EDDFBD41C5C3B5C1D217 /* AFImageDownloader.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AFImageDownloader.h; path = \"UIKit+AFNetworking/AFImageDownloader.h\"; sourceTree = \"<group>\"; };\n\t\t93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };\n\t\t9BB22389480C7BE048EF6306458D8312 /* Pods-SJNetworkingDemo-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = \"Pods-SJNetworkingDemo-resources.sh\"; sourceTree = \"<group>\"; };\n\t\tA146240B851C75BFBED24FBE69AC1C75 /* Pods-SJNetworkingDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = \"Pods-SJNetworkingDemo.release.xcconfig\"; sourceTree = \"<group>\"; };\n\t\tA64716173FC0305057230E14CDCC7A77 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; };\n\t\tAFF2CC19E35B6A289DF5C325A6C2B4E7 /* AFNetworkActivityIndicatorManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AFNetworkActivityIndicatorManager.h; path = \"UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h\"; sourceTree = \"<group>\"; };\n\t\tB9FDBCCB266ACFED93E55656FD8A014C /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/MobileCoreServices.framework; sourceTree = DEVELOPER_DIR; };\n\t\tBFD303D6F6C659A55A8684008D1476CB /* UIButton+AFNetworking.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIButton+AFNetworking.h\"; path = \"UIKit+AFNetworking/UIButton+AFNetworking.h\"; sourceTree = \"<group>\"; };\n\t\tC0DC8653B61F64B5FC03BFC2B0A6E528 /* UIImage+AFNetworking.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIImage+AFNetworking.h\"; path = \"UIKit+AFNetworking/UIImage+AFNetworking.h\"; sourceTree = \"<group>\"; };\n\t\tC23C3983ADC1EBC0A6AD3D68F3DBC4BA /* UIImageView+AFNetworking.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIImageView+AFNetworking.h\"; path = \"UIKit+AFNetworking/UIImageView+AFNetworking.h\"; sourceTree = \"<group>\"; };\n\t\tCC618B900858F4F77C2746363E77B86C /* UIRefreshControl+AFNetworking.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIRefreshControl+AFNetworking.m\"; path = \"UIKit+AFNetworking/UIRefreshControl+AFNetworking.m\"; sourceTree = \"<group>\"; };\n\t\tCEEDC6B47825FAE23C0473E4CD9B2328 /* libPods-SJNetworkingDemo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = \"libPods-SJNetworkingDemo.a\"; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tD0F90194E52430599383549278FEA918 /* UIProgressView+AFNetworking.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIProgressView+AFNetworking.m\"; path = \"UIKit+AFNetworking/UIProgressView+AFNetworking.m\"; sourceTree = \"<group>\"; };\n\t\tD1364E1A74FA884D5BCADB171DFE7353 /* AFNetworking.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = AFNetworking.xcconfig; sourceTree = \"<group>\"; };\n\t\tD1A6A32AACAE835D2C505FFBA5A27FC5 /* libAFNetworking.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libAFNetworking.a; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tD2792B01BCFFB8C68B0CE56421B99A2F /* AFURLRequestSerialization.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = AFURLRequestSerialization.m; path = AFNetworking/AFURLRequestSerialization.m; sourceTree = \"<group>\"; };\n\t\tE451FBBEE5D302A74D966AC502CE5B19 /* UIActivityIndicatorView+AFNetworking.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIActivityIndicatorView+AFNetworking.h\"; path = \"UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h\"; sourceTree = \"<group>\"; };\n\t\tE71FC5436C29FCEB72394E7117726B8F /* AFNetworking.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AFNetworking.h; path = AFNetworking/AFNetworking.h; sourceTree = \"<group>\"; };\n\t\tEB64652F64024650906BF262B3C68BB2 /* Pods-SJNetworkingDemo-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = \"Pods-SJNetworkingDemo-frameworks.sh\"; sourceTree = \"<group>\"; };\n\t\tEC8A7C0B6179467051ED95E59DB2AF9F /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/SystemConfiguration.framework; sourceTree = DEVELOPER_DIR; };\n\t\tF921D275AC6AA48C031BF91FD4592584 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\tFE9DC137B1B02C802E7ABBECC9401A7B /* AFNetworkActivityIndicatorManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = AFNetworkActivityIndicatorManager.m; path = \"UIKit+AFNetworking/AFNetworkActivityIndicatorManager.m\"; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\tA970726797744A214AE1FC3A895DB7E2 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE5EA3FA0ADD052B6A897467C05845B71 /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tF3284DBE3CA8932733932AD2A48445B2 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tCBCCEAD402645565401CA93924736979 /* CoreGraphics.framework in Frameworks */,\n\t\t\t\t0214246CCB1FF7182F7222B9CCDF8FCB /* Foundation.framework in Frameworks */,\n\t\t\t\tF8DCA6C3C05A59B2C95A1B5F1CBD8C99 /* MobileCoreServices.framework in Frameworks */,\n\t\t\t\tDE825B8F32AB823F4BE5492CAC6FCB4B /* Security.framework in Frameworks */,\n\t\t\t\t903158692A045396106CA22C0DD13BA6 /* SystemConfiguration.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t0336952400392A094D9CF93F23FBA803 /* Reachability */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t357FC25AA9F2E82213C986CE50969E1A /* AFNetworkReachabilityManager.h */,\n\t\t\t\t4852ABEFD7FFFAE072C5835CCDB22279 /* AFNetworkReachabilityManager.m */,\n\t\t\t);\n\t\t\tname = Reachability;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t118C018DD63A7C9B85C796B9D7927B72 /* Serialization */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t18B9DCDB5BE79C17D786D046D23A6C8F /* AFURLRequestSerialization.h */,\n\t\t\t\tD2792B01BCFFB8C68B0CE56421B99A2F /* AFURLRequestSerialization.m */,\n\t\t\t\t8946DE00AC08571F0D4A4F985A8FA609 /* AFURLResponseSerialization.h */,\n\t\t\t\t1E990D35FEF51D7420F303E35DCBE1F6 /* AFURLResponseSerialization.m */,\n\t\t\t);\n\t\t\tname = Serialization;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t1C26585A924F80DB59965DD3B7AB0AD1 /* NSURLSession */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t42C03FCF30AB48A3B8DC805A289477E2 /* AFHTTPSessionManager.h */,\n\t\t\t\t42EAD270211F301E809EA7C39D05A3DC /* AFHTTPSessionManager.m */,\n\t\t\t\t525066ED64B26EC45F9B2AD4D3B0D1B2 /* AFURLSessionManager.h */,\n\t\t\t\t809E0EE6429DA2700D30D5F8F46F4100 /* AFURLSessionManager.m */,\n\t\t\t);\n\t\t\tname = NSURLSession;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t20B56609144CE204DFA8221F742B2D76 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tCB79318D3E8AF2183319FF8098C5AE5E /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t2C186AA24E2640F4BC841D3813B8BAE7 /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD1364E1A74FA884D5BCADB171DFE7353 /* AFNetworking.xcconfig */,\n\t\t\t\t14F2B0D3DD13B76429F713F1F1A1CC6F /* AFNetworking-dummy.m */,\n\t\t\t\t14673F01BA2ED5D126E93E99A45B2088 /* AFNetworking-prefix.pch */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/AFNetworking\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t641BDD347DE7B8BB81D6CA5727C6EC5A /* Pods */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD8AEA08F300093373DE87ADAC55F71FA /* AFNetworking */,\n\t\t\t);\n\t\t\tname = Pods;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t64B71C384435C48FAA2EDD45AEDAF210 /* UIKit */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t18A6CC7151721E485930D715056633ED /* AFAutoPurgingImageCache.h */,\n\t\t\t\t1246CB48952FF37C1DB54894C46F6390 /* AFAutoPurgingImageCache.m */,\n\t\t\t\t8B17FF80B117EDDFBD41C5C3B5C1D217 /* AFImageDownloader.h */,\n\t\t\t\t8006E5A6F0951AA637FFA7F53DBA00D9 /* AFImageDownloader.m */,\n\t\t\t\tAFF2CC19E35B6A289DF5C325A6C2B4E7 /* AFNetworkActivityIndicatorManager.h */,\n\t\t\t\tFE9DC137B1B02C802E7ABBECC9401A7B /* AFNetworkActivityIndicatorManager.m */,\n\t\t\t\tE451FBBEE5D302A74D966AC502CE5B19 /* UIActivityIndicatorView+AFNetworking.h */,\n\t\t\t\t4D925E789318555435D0DBEF9BEC8015 /* UIActivityIndicatorView+AFNetworking.m */,\n\t\t\t\tBFD303D6F6C659A55A8684008D1476CB /* UIButton+AFNetworking.h */,\n\t\t\t\t516F3F2A9B24B2E2092E84E8EAF0A9F7 /* UIButton+AFNetworking.m */,\n\t\t\t\tC0DC8653B61F64B5FC03BFC2B0A6E528 /* UIImage+AFNetworking.h */,\n\t\t\t\tC23C3983ADC1EBC0A6AD3D68F3DBC4BA /* UIImageView+AFNetworking.h */,\n\t\t\t\t0E9837C7FFCFC4203B1BAADAADD8E206 /* UIImageView+AFNetworking.m */,\n\t\t\t\t20CB1302DD85B80CBADE42E436CF5930 /* UIKit+AFNetworking.h */,\n\t\t\t\t1207584E6BDCF4C846A1DDFE0BCFEECF /* UIProgressView+AFNetworking.h */,\n\t\t\t\tD0F90194E52430599383549278FEA918 /* UIProgressView+AFNetworking.m */,\n\t\t\t\t78C774AEA3474BF09AD285C28E701D5F /* UIRefreshControl+AFNetworking.h */,\n\t\t\t\tCC618B900858F4F77C2746363E77B86C /* UIRefreshControl+AFNetworking.m */,\n\t\t\t\t036FDD48539129C05AAE4C9ACA312100 /* UIWebView+AFNetworking.h */,\n\t\t\t\t51204DFB5BF601D556D71C3736263351 /* UIWebView+AFNetworking.m */,\n\t\t\t);\n\t\t\tname = UIKit;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t756660C6DE7595D1FE367D86CA8BFC1F /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD1A6A32AACAE835D2C505FFBA5A27FC5 /* libAFNetworking.a */,\n\t\t\t\tCEEDC6B47825FAE23C0473E4CD9B2328 /* libPods-SJNetworkingDemo.a */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t7DB346D0F39D3F0E887471402A8071AB = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */,\n\t\t\t\t20B56609144CE204DFA8221F742B2D76 /* Frameworks */,\n\t\t\t\t641BDD347DE7B8BB81D6CA5727C6EC5A /* Pods */,\n\t\t\t\t756660C6DE7595D1FE367D86CA8BFC1F /* Products */,\n\t\t\t\tAFC7C26271B86F78102072B858F04D6B /* Targets Support Files */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tAFC7C26271B86F78102072B858F04D6B /* Targets Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tDDFC3700ADEF928DB822C1A95BCCB9DF /* Pods-SJNetworkingDemo */,\n\t\t\t);\n\t\t\tname = \"Targets Support Files\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tCB79318D3E8AF2183319FF8098C5AE5E /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tA64716173FC0305057230E14CDCC7A77 /* CoreGraphics.framework */,\n\t\t\t\tF921D275AC6AA48C031BF91FD4592584 /* Foundation.framework */,\n\t\t\t\tB9FDBCCB266ACFED93E55656FD8A014C /* MobileCoreServices.framework */,\n\t\t\t\t12A9374C39A6EFA90AD3F2E64799ECC5 /* Security.framework */,\n\t\t\t\tEC8A7C0B6179467051ED95E59DB2AF9F /* SystemConfiguration.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tD8AEA08F300093373DE87ADAC55F71FA /* AFNetworking */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE71FC5436C29FCEB72394E7117726B8F /* AFNetworking.h */,\n\t\t\t\t1C26585A924F80DB59965DD3B7AB0AD1 /* NSURLSession */,\n\t\t\t\t0336952400392A094D9CF93F23FBA803 /* Reachability */,\n\t\t\t\tE9A2D2E704D5128BD90065AA48D6522C /* Security */,\n\t\t\t\t118C018DD63A7C9B85C796B9D7927B72 /* Serialization */,\n\t\t\t\t2C186AA24E2640F4BC841D3813B8BAE7 /* Support Files */,\n\t\t\t\t64B71C384435C48FAA2EDD45AEDAF210 /* UIKit */,\n\t\t\t);\n\t\t\tpath = AFNetworking;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tDDFC3700ADEF928DB822C1A95BCCB9DF /* Pods-SJNetworkingDemo */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t160CC776F085040F2BB1774841D86F45 /* Pods-SJNetworkingDemo-acknowledgements.markdown */,\n\t\t\t\t81878840D53F53CA43E24C220CA96467 /* Pods-SJNetworkingDemo-acknowledgements.plist */,\n\t\t\t\t3049B48EF8F1C0E188C2ABC513E28E3A /* Pods-SJNetworkingDemo-dummy.m */,\n\t\t\t\tEB64652F64024650906BF262B3C68BB2 /* Pods-SJNetworkingDemo-frameworks.sh */,\n\t\t\t\t9BB22389480C7BE048EF6306458D8312 /* Pods-SJNetworkingDemo-resources.sh */,\n\t\t\t\t3B171D29EF26E7837600FD517F97B50B /* Pods-SJNetworkingDemo.debug.xcconfig */,\n\t\t\t\tA146240B851C75BFBED24FBE69AC1C75 /* Pods-SJNetworkingDemo.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Pods-SJNetworkingDemo\";\n\t\t\tpath = \"Target Support Files/Pods-SJNetworkingDemo\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE9A2D2E704D5128BD90065AA48D6522C /* Security */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t0401DF9E61B17C3AE9FE93347CCD9E64 /* AFSecurityPolicy.h */,\n\t\t\t\t3B8C2F3F38AC8B05D07C9BAACD044EAD /* AFSecurityPolicy.m */,\n\t\t\t);\n\t\t\tname = Security;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t0A1C2B07813030B0D51EB1D804A4439E /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tF1F93EE1AA5E870F2CE81325CE9EB643 /* AFAutoPurgingImageCache.h in Headers */,\n\t\t\t\t6B71CE5BA32574F407349C1DA20605B4 /* AFHTTPSessionManager.h in Headers */,\n\t\t\t\t707E818332E5033501DF2D7826C639DF /* AFImageDownloader.h in Headers */,\n\t\t\t\tE7B0270BEDCBE116DDD853F76E27B0BA /* AFNetworkActivityIndicatorManager.h in Headers */,\n\t\t\t\t46401F3C7FF0B0CFE2E9B14914780835 /* AFNetworking.h in Headers */,\n\t\t\t\tDE31BBF6A7963C5871A19655EF5532BE /* AFNetworkReachabilityManager.h in Headers */,\n\t\t\t\tD59FC98A74E440C4725B6FDC28F5951E /* AFSecurityPolicy.h in Headers */,\n\t\t\t\tC1C0D7C93BF3DE14A26757273598D0FA /* AFURLRequestSerialization.h in Headers */,\n\t\t\t\t66635EAAE52FF5571DBCDC626FB8CA86 /* AFURLResponseSerialization.h in Headers */,\n\t\t\t\tF5CC06F3E0C232483A72DCCFAF393BE0 /* AFURLSessionManager.h in Headers */,\n\t\t\t\t682B0E603612B6ADBCCF30580F9A4B09 /* UIActivityIndicatorView+AFNetworking.h in Headers */,\n\t\t\t\t2EBAA518CB8B2DAF89A63637091D4615 /* UIButton+AFNetworking.h in Headers */,\n\t\t\t\t1341A7AC2439CB63D459D32EF985A414 /* UIImage+AFNetworking.h in Headers */,\n\t\t\t\tD5CB999FB5FC80FC126A38AB4DF12227 /* UIImageView+AFNetworking.h in Headers */,\n\t\t\t\t5719F06B809080CDEF7E6BC75DEA1A3C /* UIKit+AFNetworking.h in Headers */,\n\t\t\t\tB40756412613B53C80EE77C4C223990F /* UIProgressView+AFNetworking.h in Headers */,\n\t\t\t\tF099E5987DD80E8D78E909AF81D3C587 /* UIRefreshControl+AFNetworking.h in Headers */,\n\t\t\t\t8958F2453EEBAF71BFEBD78FB48986EC /* UIWebView+AFNetworking.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t0540431F6E8ABBD1B9D3657AA777FD11 /* Pods-SJNetworkingDemo */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = DF8E60E20613DCCAA38C7B1DC717328E /* Build configuration list for PBXNativeTarget \"Pods-SJNetworkingDemo\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t8B8BF62E582F1866377E640D5E074B1A /* Sources */,\n\t\t\t\tA970726797744A214AE1FC3A895DB7E2 /* Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t868E808C9B9736FDD2012BB3014F295E /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = \"Pods-SJNetworkingDemo\";\n\t\t\tproductName = \"Pods-SJNetworkingDemo\";\n\t\t\tproductReference = CEEDC6B47825FAE23C0473E4CD9B2328 /* libPods-SJNetworkingDemo.a */;\n\t\t\tproductType = \"com.apple.product-type.library.static\";\n\t\t};\n\t\t9E033EDB5EC0819481B0546434FA577B /* AFNetworking */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 483FBC4A668BF7F1A8767452E7E188AC /* Build configuration list for PBXNativeTarget \"AFNetworking\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t0068413C89BADAAF4691AA78AFE62C3E /* Sources */,\n\t\t\t\tF3284DBE3CA8932733932AD2A48445B2 /* Frameworks */,\n\t\t\t\t0A1C2B07813030B0D51EB1D804A4439E /* Headers */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = AFNetworking;\n\t\t\tproductName = AFNetworking;\n\t\t\tproductReference = D1A6A32AACAE835D2C505FFBA5A27FC5 /* libAFNetworking.a */;\n\t\t\tproductType = \"com.apple.product-type.library.static\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tD41D8CD98F00B204E9800998ECF8427E /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 0830;\n\t\t\t\tLastUpgradeCheck = 0910;\n\t\t\t};\n\t\t\tbuildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject \"Pods\" */;\n\t\t\tcompatibilityVersion = \"Xcode 3.2\";\n\t\t\tdevelopmentRegion = English;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 7DB346D0F39D3F0E887471402A8071AB;\n\t\t\tproductRefGroup = 756660C6DE7595D1FE367D86CA8BFC1F /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t9E033EDB5EC0819481B0546434FA577B /* AFNetworking */,\n\t\t\t\t0540431F6E8ABBD1B9D3657AA777FD11 /* Pods-SJNetworkingDemo */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t0068413C89BADAAF4691AA78AFE62C3E /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t775CE7A8107457BDE59F113D40020839 /* AFAutoPurgingImageCache.m in Sources */,\n\t\t\t\t73811DA312BCB537D44D62EC6AD15766 /* AFHTTPSessionManager.m in Sources */,\n\t\t\t\t5C0696B2AD1DC23F6473F5A19FAB6296 /* AFImageDownloader.m in Sources */,\n\t\t\t\t31ED9BD97AF9E62874AF3CDF2F8090CF /* AFNetworkActivityIndicatorManager.m in Sources */,\n\t\t\t\t97A86FAAD4B1AD9B3292FF6AF1D8F82B /* AFNetworking-dummy.m in Sources */,\n\t\t\t\tE0EF330DB2D3521ED26E67B2E8687A2E /* AFNetworkReachabilityManager.m in Sources */,\n\t\t\t\t66E1040543AF7BA3DC3731FE17C85F5B /* AFSecurityPolicy.m in Sources */,\n\t\t\t\t5945033488F9995134DBB7014DE2412F /* AFURLRequestSerialization.m in Sources */,\n\t\t\t\t85D30678FF4F0AB306399A368EAA46B2 /* AFURLResponseSerialization.m in Sources */,\n\t\t\t\t9F5BB6B4995BA4A3B2C6AEBA6C31A6DB /* AFURLSessionManager.m in Sources */,\n\t\t\t\t2579663181BFA8F7DA4B5D7CF8537FC0 /* UIActivityIndicatorView+AFNetworking.m in Sources */,\n\t\t\t\tD10CC46035F7A0C868C0955664A34609 /* UIButton+AFNetworking.m in Sources */,\n\t\t\t\tA277AD9070E44BED5A7DE0B1D64D6F15 /* UIImageView+AFNetworking.m in Sources */,\n\t\t\t\tD4AA4704CA7863CC86E22AAF88635836 /* UIProgressView+AFNetworking.m in Sources */,\n\t\t\t\tB84CD33084C9867E67BD56E47B7BFC04 /* UIRefreshControl+AFNetworking.m in Sources */,\n\t\t\t\tA7F7FDCD36E2DD8D8E346DB19452CC03 /* UIWebView+AFNetworking.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t8B8BF62E582F1866377E640D5E074B1A /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tA10762E25BF68C0C03081C7D5906CE4D /* Pods-SJNetworkingDemo-dummy.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\t868E808C9B9736FDD2012BB3014F295E /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = AFNetworking;\n\t\t\ttarget = 9E033EDB5EC0819481B0546434FA577B /* AFNetworking */;\n\t\t\ttargetProxy = D6013EEAD8842F3CE01C0268E3D15430 /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin XCBuildConfiguration section */\n\t\t5403CB947ED72BD789353EE9D9D58376 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = D1364E1A74FA884D5BCADB171DFE7353 /* AFNetworking.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_IDENTITY = \"iPhone Developer\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/AFNetworking/AFNetworking-prefix.pch\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tOTHER_LDFLAGS = \"\";\n\t\t\t\tOTHER_LIBTOOLFLAGS = \"\";\n\t\t\t\tPRIVATE_HEADERS_FOLDER_PATH = \"\";\n\t\t\t\tPUBLIC_HEADERS_FOLDER_PATH = \"\";\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t7C246F7AA69D78A801B26483203E4806 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = D1364E1A74FA884D5BCADB171DFE7353 /* AFNetworking.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_IDENTITY = \"iPhone Developer\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/AFNetworking/AFNetworking-prefix.pch\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tOTHER_LDFLAGS = \"\";\n\t\t\t\tOTHER_LIBTOOLFLAGS = \"\";\n\t\t\t\tPRIVATE_HEADERS_FOLDER_PATH = \"\";\n\t\t\t\tPUBLIC_HEADERS_FOLDER_PATH = \"\";\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tB254DAA6CF0CE39F4A3D11B90A7E059A /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCODE_SIGNING_REQUIRED = NO;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tPROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/;\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tC5219AFB1BB9467C1E6F7088A9569B3D /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 3B171D29EF26E7837600FD517F97B50B /* Pods-SJNetworkingDemo.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_IDENTITY = \"iPhone Developer\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMACH_O_TYPE = staticlib;\n\t\t\t\tOTHER_LDFLAGS = \"\";\n\t\t\t\tOTHER_LIBTOOLFLAGS = \"\";\n\t\t\t\tPODS_ROOT = \"$(SRCROOT)\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE4B68EE12B21C47CB798D9B1ECA6D7A7 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCODE_SIGNING_REQUIRED = NO;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tPROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/;\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tFFB8E6E68F8549F0B0625988B8B501FB /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = A146240B851C75BFBED24FBE69AC1C75 /* Pods-SJNetworkingDemo.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_IDENTITY = \"iPhone Developer\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMACH_O_TYPE = staticlib;\n\t\t\t\tOTHER_LDFLAGS = \"\";\n\t\t\t\tOTHER_LIBTOOLFLAGS = \"\";\n\t\t\t\tPODS_ROOT = \"$(SRCROOT)\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject \"Pods\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE4B68EE12B21C47CB798D9B1ECA6D7A7 /* Debug */,\n\t\t\t\tB254DAA6CF0CE39F4A3D11B90A7E059A /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t483FBC4A668BF7F1A8767452E7E188AC /* Build configuration list for PBXNativeTarget \"AFNetworking\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t7C246F7AA69D78A801B26483203E4806 /* Debug */,\n\t\t\t\t5403CB947ED72BD789353EE9D9D58376 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tDF8E60E20613DCCAA38C7B1DC717328E /* Build configuration list for PBXNativeTarget \"Pods-SJNetworkingDemo\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tC5219AFB1BB9467C1E6F7088A9569B3D /* Debug */,\n\t\t\t\tFFB8E6E68F8549F0B0625988B8B501FB /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = D41D8CD98F00B204E9800998ECF8427E /* Project object */;\n}\n"
  },
  {
    "path": "SJNetworkDemo/Pods/Pods.xcodeproj/xcuserdata/SunShijie.xcuserdatad/xcschemes/AFNetworking.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"0910\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"9E033EDB5EC0819481B0546434FA577B\"\n               BuildableName = \"libAFNetworking.a\"\n               BlueprintName = \"AFNetworking\"\n               ReferencedContainer = \"container:Pods.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      language = \"\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\">\n      <Testables>\n      </Testables>\n      <AdditionalOptions>\n      </AdditionalOptions>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      language = \"\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"9E033EDB5EC0819481B0546434FA577B\"\n            BuildableName = \"libAFNetworking.a\"\n            BlueprintName = \"AFNetworking\"\n            ReferencedContainer = \"container:Pods.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <AdditionalOptions>\n      </AdditionalOptions>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "SJNetworkDemo/Pods/Pods.xcodeproj/xcuserdata/SunShijie.xcuserdatad/xcschemes/Pods-SJNetworkingDemo.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"0910\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"0540431F6E8ABBD1B9D3657AA777FD11\"\n               BuildableName = \"libPods-SJNetworkingDemo.a\"\n               BlueprintName = \"Pods-SJNetworkingDemo\"\n               ReferencedContainer = \"container:Pods.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      language = \"\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\">\n      <Testables>\n      </Testables>\n      <AdditionalOptions>\n      </AdditionalOptions>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      language = \"\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"0540431F6E8ABBD1B9D3657AA777FD11\"\n            BuildableName = \"libPods-SJNetworkingDemo.a\"\n            BlueprintName = \"Pods-SJNetworkingDemo\"\n            ReferencedContainer = \"container:Pods.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <AdditionalOptions>\n      </AdditionalOptions>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "SJNetworkDemo/Pods/Pods.xcodeproj/xcuserdata/SunShijie.xcuserdatad/xcschemes/xcschememanagement.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>SchemeUserState</key>\n\t<dict>\n\t\t<key>AFNetworking.xcscheme</key>\n\t\t<dict>\n\t\t\t<key>isShown</key>\n\t\t\t<false/>\n\t\t\t<key>orderHint</key>\n\t\t\t<integer>0</integer>\n\t\t</dict>\n\t\t<key>Pods-SJNetworkingDemo.xcscheme</key>\n\t\t<dict>\n\t\t\t<key>isShown</key>\n\t\t\t<false/>\n\t\t\t<key>orderHint</key>\n\t\t\t<integer>1</integer>\n\t\t</dict>\n\t</dict>\n\t<key>SuppressBuildableAutocreation</key>\n\t<dict/>\n</dict>\n</plist>\n"
  },
  {
    "path": "SJNetworkDemo/Pods/Target Support Files/AFNetworking/AFNetworking-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_AFNetworking : NSObject\n@end\n@implementation PodsDummy_AFNetworking\n@end\n"
  },
  {
    "path": "SJNetworkDemo/Pods/Target Support Files/AFNetworking/AFNetworking-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n#ifndef TARGET_OS_IOS\n  #define TARGET_OS_IOS TARGET_OS_IPHONE\n#endif\n\n#ifndef TARGET_OS_WATCH\n  #define TARGET_OS_WATCH 0\n#endif\n\n#ifndef TARGET_OS_TV\n  #define TARGET_OS_TV 0\n#endif\n"
  },
  {
    "path": "SJNetworkDemo/Pods/Target Support Files/AFNetworking/AFNetworking.xcconfig",
    "content": "CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/AFNetworking\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nHEADER_SEARCH_PATHS = \"${PODS_ROOT}/Headers/Private\" \"${PODS_ROOT}/Headers/Private/AFNetworking\" \"${PODS_ROOT}/Headers/Public\" \"${PODS_ROOT}/Headers/Public/AFNetworking\"\nOTHER_LDFLAGS = -framework \"CoreGraphics\" -framework \"MobileCoreServices\" -framework \"Security\" -framework \"SystemConfiguration\"\nPODS_BUILD_DIR = $BUILD_DIR\nPODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/AFNetworking\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\n"
  },
  {
    "path": "SJNetworkDemo/Pods/Target Support Files/Pods-SJNetworkingDemo/Pods-SJNetworkingDemo-acknowledgements.markdown",
    "content": "# Acknowledgements\nThis application makes use of the following third party libraries:\n\n## AFNetworking\n\nCopyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\nGenerated by CocoaPods - https://cocoapods.org\n"
  },
  {
    "path": "SJNetworkDemo/Pods/Target Support Files/Pods-SJNetworkingDemo/Pods-SJNetworkingDemo-acknowledgements.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>PreferenceSpecifiers</key>\n\t<array>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>This application makes use of the following third party libraries:</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>Acknowledgements</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>AFNetworking</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>Generated by CocoaPods - https://cocoapods.org</string>\n\t\t\t<key>Title</key>\n\t\t\t<string></string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t</array>\n\t<key>StringsTable</key>\n\t<string>Acknowledgements</string>\n\t<key>Title</key>\n\t<string>Acknowledgements</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "SJNetworkDemo/Pods/Target Support Files/Pods-SJNetworkingDemo/Pods-SJNetworkingDemo-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_Pods_SJNetworkingDemo : NSObject\n@end\n@implementation PodsDummy_Pods_SJNetworkingDemo\n@end\n"
  },
  {
    "path": "SJNetworkDemo/Pods/Target Support Files/Pods-SJNetworkingDemo/Pods-SJNetworkingDemo-frameworks.sh",
    "content": "#!/bin/sh\nset -e\n\necho \"mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\nmkdir -p \"${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\n\nSWIFT_STDLIB_PATH=\"${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\"\n\n# This protects against multiple targets copying the same framework dependency at the same time. The solution\n# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html\nRSYNC_PROTECT_TMP_FILES=(--filter \"P .*.??????\")\n\ninstall_framework()\n{\n  if [ -r \"${BUILT_PRODUCTS_DIR}/$1\" ]; then\n    local source=\"${BUILT_PRODUCTS_DIR}/$1\"\n  elif [ -r \"${BUILT_PRODUCTS_DIR}/$(basename \"$1\")\" ]; then\n    local source=\"${BUILT_PRODUCTS_DIR}/$(basename \"$1\")\"\n  elif [ -r \"$1\" ]; then\n    local source=\"$1\"\n  fi\n\n  local destination=\"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\n\n  if [ -L \"${source}\" ]; then\n      echo \"Symlinked...\"\n      source=\"$(readlink \"${source}\")\"\n  fi\n\n  # Use filter instead of exclude so missing patterns don't throw errors.\n  echo \"rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" --filter \\\"- CVS/\\\" --filter \\\"- .svn/\\\" --filter \\\"- .git/\\\" --filter \\\"- .hg/\\\" --filter \\\"- Headers\\\" --filter \\\"- PrivateHeaders\\\" --filter \\\"- Modules\\\" \\\"${source}\\\" \\\"${destination}\\\"\"\n  rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"\n\n  local basename\n  basename=\"$(basename -s .framework \"$1\")\"\n  binary=\"${destination}/${basename}.framework/${basename}\"\n  if ! [ -r \"$binary\" ]; then\n    binary=\"${destination}/${basename}\"\n  fi\n\n  # Strip invalid architectures so \"fat\" simulator / device frameworks work on device\n  if [[ \"$(file \"$binary\")\" == *\"dynamically linked shared library\"* ]]; then\n    strip_invalid_archs \"$binary\"\n  fi\n\n  # Resign the code if required by the build settings to avoid unstable apps\n  code_sign_if_enabled \"${destination}/$(basename \"$1\")\"\n\n  # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.\n  if [ \"${XCODE_VERSION_MAJOR}\" -lt 7 ]; then\n    local swift_runtime_libs\n    swift_runtime_libs=$(xcrun otool -LX \"$binary\" | grep --color=never @rpath/libswift | sed -E s/@rpath\\\\/\\(.+dylib\\).*/\\\\1/g | uniq -u  && exit ${PIPESTATUS[0]})\n    for lib in $swift_runtime_libs; do\n      echo \"rsync -auv \\\"${SWIFT_STDLIB_PATH}/${lib}\\\" \\\"${destination}\\\"\"\n      rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"\n      code_sign_if_enabled \"${destination}/${lib}\"\n    done\n  fi\n}\n\n# Copies the dSYM of a vendored framework\ninstall_dsym() {\n  local source=\"$1\"\n  if [ -r \"$source\" ]; then\n    echo \"rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" --filter \\\"- CVS/\\\" --filter \\\"- .svn/\\\" --filter \\\"- .git/\\\" --filter \\\"- .hg/\\\" --filter \\\"- Headers\\\" --filter \\\"- PrivateHeaders\\\" --filter \\\"- Modules\\\" \\\"${source}\\\" \\\"${DWARF_DSYM_FOLDER_PATH}\\\"\"\n    rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DWARF_DSYM_FOLDER_PATH}\"\n  fi\n}\n\n# Signs a framework with the provided identity\ncode_sign_if_enabled() {\n  if [ -n \"${EXPANDED_CODE_SIGN_IDENTITY}\" -a \"${CODE_SIGNING_REQUIRED}\" != \"NO\" -a \"${CODE_SIGNING_ALLOWED}\" != \"NO\" ]; then\n    # Use the current code_sign_identitiy\n    echo \"Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}\"\n    local code_sign_cmd=\"/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'\"\n\n    if [ \"${COCOAPODS_PARALLEL_CODE_SIGN}\" == \"true\" ]; then\n      code_sign_cmd=\"$code_sign_cmd &\"\n    fi\n    echo \"$code_sign_cmd\"\n    eval \"$code_sign_cmd\"\n  fi\n}\n\n# Strip invalid architectures\nstrip_invalid_archs() {\n  binary=\"$1\"\n  # Get architectures for current file\n  archs=\"$(lipo -info \"$binary\" | rev | cut -d ':' -f1 | rev)\"\n  stripped=\"\"\n  for arch in $archs; do\n    if ! [[ \"${ARCHS}\" == *\"$arch\"* ]]; then\n      # Strip non-valid architectures in-place\n      lipo -remove \"$arch\" -output \"$binary\" \"$binary\" || exit 1\n      stripped=\"$stripped $arch\"\n    fi\n  done\n  if [[ \"$stripped\" ]]; then\n    echo \"Stripped $binary of architectures:$stripped\"\n  fi\n}\n\nif [ \"${COCOAPODS_PARALLEL_CODE_SIGN}\" == \"true\" ]; then\n  wait\nfi\n"
  },
  {
    "path": "SJNetworkDemo/Pods/Target Support Files/Pods-SJNetworkingDemo/Pods-SJNetworkingDemo-resources.sh",
    "content": "#!/bin/sh\nset -e\n\nmkdir -p \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\"\n\nRESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt\n> \"$RESOURCES_TO_COPY\"\n\nXCASSET_FILES=()\n\n# This protects against multiple targets copying the same framework dependency at the same time. The solution\n# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html\nRSYNC_PROTECT_TMP_FILES=(--filter \"P .*.??????\")\n\ncase \"${TARGETED_DEVICE_FAMILY}\" in\n  1,2)\n    TARGET_DEVICE_ARGS=\"--target-device ipad --target-device iphone\"\n    ;;\n  1)\n    TARGET_DEVICE_ARGS=\"--target-device iphone\"\n    ;;\n  2)\n    TARGET_DEVICE_ARGS=\"--target-device ipad\"\n    ;;\n  3)\n    TARGET_DEVICE_ARGS=\"--target-device tv\"\n    ;;\n  4)\n    TARGET_DEVICE_ARGS=\"--target-device watch\"\n    ;;\n  *)\n    TARGET_DEVICE_ARGS=\"--target-device mac\"\n    ;;\nesac\n\ninstall_resource()\n{\n  if [[ \"$1\" = /* ]] ; then\n    RESOURCE_PATH=\"$1\"\n  else\n    RESOURCE_PATH=\"${PODS_ROOT}/$1\"\n  fi\n  if [[ ! -e \"$RESOURCE_PATH\" ]] ; then\n    cat << EOM\nerror: Resource \"$RESOURCE_PATH\" not found. Run 'pod install' to update the copy resources script.\nEOM\n    exit 1\n  fi\n  case $RESOURCE_PATH in\n    *.storyboard)\n      echo \"ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\\"$RESOURCE_PATH\\\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}\" || true\n      ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\\"$RESOURCE_PATH\\\" .storyboard`.storyboardc\" \"$RESOURCE_PATH\" --sdk \"${SDKROOT}\" ${TARGET_DEVICE_ARGS}\n      ;;\n    *.xib)\n      echo \"ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\\"$RESOURCE_PATH\\\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}\" || true\n      ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\\"$RESOURCE_PATH\\\" .xib`.nib\" \"$RESOURCE_PATH\" --sdk \"${SDKROOT}\" ${TARGET_DEVICE_ARGS}\n      ;;\n    *.framework)\n      echo \"mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\" || true\n      mkdir -p \"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\n      echo \"rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\" || true\n      rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\n      ;;\n    *.xcdatamodel)\n      echo \"xcrun momc \\\"$RESOURCE_PATH\\\" \\\"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\"`.mom\\\"\" || true\n      xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xcdatamodel`.mom\"\n      ;;\n    *.xcdatamodeld)\n      echo \"xcrun momc \\\"$RESOURCE_PATH\\\" \\\"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xcdatamodeld`.momd\\\"\" || true\n      xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xcdatamodeld`.momd\"\n      ;;\n    *.xcmappingmodel)\n      echo \"xcrun mapc \\\"$RESOURCE_PATH\\\" \\\"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xcmappingmodel`.cdm\\\"\" || true\n      xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xcmappingmodel`.cdm\"\n      ;;\n    *.xcassets)\n      ABSOLUTE_XCASSET_FILE=\"$RESOURCE_PATH\"\n      XCASSET_FILES+=(\"$ABSOLUTE_XCASSET_FILE\")\n      ;;\n    *)\n      echo \"$RESOURCE_PATH\" || true\n      echo \"$RESOURCE_PATH\" >> \"$RESOURCES_TO_COPY\"\n      ;;\n  esac\n}\n\nmkdir -p \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\"\nrsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from=\"$RESOURCES_TO_COPY\" / \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\"\nif [[ \"${ACTION}\" == \"install\" ]] && [[ \"${SKIP_INSTALL}\" == \"NO\" ]]; then\n  mkdir -p \"${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\"\n  rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from=\"$RESOURCES_TO_COPY\" / \"${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\"\nfi\nrm -f \"$RESOURCES_TO_COPY\"\n\nif [[ -n \"${WRAPPER_EXTENSION}\" ]] && [ \"`xcrun --find actool`\" ] && [ -n \"$XCASSET_FILES\" ]\nthen\n  # Find all other xcassets (this unfortunately includes those of path pods and other targets).\n  OTHER_XCASSETS=$(find \"$PWD\" -iname \"*.xcassets\" -type d)\n  while read line; do\n    if [[ $line != \"${PODS_ROOT}*\" ]]; then\n      XCASSET_FILES+=(\"$line\")\n    fi\n  done <<<\"$OTHER_XCASSETS\"\n\n  printf \"%s\\0\" \"${XCASSET_FILES[@]}\" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform \"${PLATFORM_NAME}\" --minimum-deployment-target \"${!DEPLOYMENT_TARGET_SETTING_NAME}\" ${TARGET_DEVICE_ARGS} --compress-pngs --compile \"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\"\nfi\n"
  },
  {
    "path": "SJNetworkDemo/Pods/Target Support Files/Pods-SJNetworkingDemo/Pods-SJNetworkingDemo.debug.xcconfig",
    "content": "GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nHEADER_SEARCH_PATHS = $(inherited) \"${PODS_ROOT}/Headers/Public\" \"${PODS_ROOT}/Headers/Public/AFNetworking\"\nLIBRARY_SEARCH_PATHS = $(inherited) \"$PODS_CONFIGURATION_BUILD_DIR/AFNetworking\"\nOTHER_CFLAGS = $(inherited) -isystem \"${PODS_ROOT}/Headers/Public\" -isystem \"${PODS_ROOT}/Headers/Public/AFNetworking\"\nOTHER_LDFLAGS = $(inherited) -ObjC -l\"AFNetworking\" -framework \"CoreGraphics\" -framework \"MobileCoreServices\" -framework \"Security\" -framework \"SystemConfiguration\"\nPODS_BUILD_DIR = $BUILD_DIR\nPODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_PODFILE_DIR_PATH = ${SRCROOT}/.\nPODS_ROOT = ${SRCROOT}/Pods\n"
  },
  {
    "path": "SJNetworkDemo/Pods/Target Support Files/Pods-SJNetworkingDemo/Pods-SJNetworkingDemo.release.xcconfig",
    "content": "GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nHEADER_SEARCH_PATHS = $(inherited) \"${PODS_ROOT}/Headers/Public\" \"${PODS_ROOT}/Headers/Public/AFNetworking\"\nLIBRARY_SEARCH_PATHS = $(inherited) \"$PODS_CONFIGURATION_BUILD_DIR/AFNetworking\"\nOTHER_CFLAGS = $(inherited) -isystem \"${PODS_ROOT}/Headers/Public\" -isystem \"${PODS_ROOT}/Headers/Public/AFNetworking\"\nOTHER_LDFLAGS = $(inherited) -ObjC -l\"AFNetworking\" -framework \"CoreGraphics\" -framework \"MobileCoreServices\" -framework \"Security\" -framework \"SystemConfiguration\"\nPODS_BUILD_DIR = $BUILD_DIR\nPODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_PODFILE_DIR_PATH = ${SRCROOT}/.\nPODS_ROOT = ${SRCROOT}/Pods\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/Other/AppDelegate.h",
    "content": "//\n//  AppDelegate.h\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/23.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\n@interface AppDelegate : UIResponder <UIApplicationDelegate>\n\n@property (strong, nonatomic) UIWindow *window;\n\n\n@end\n\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/Other/AppDelegate.m",
    "content": "//\n//  AppDelegate.m\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/23.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"AppDelegate.h\"\n#import \"SJNetwork.h\"\n\n@interface AppDelegate ()\n\n@end\n\n@implementation AppDelegate\n\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n    \n    // Override point for customization after application launch.\n    \n    \n    [SJNetworkConfig sharedConfig].debugMode = YES;\n    [SJNetworkConfig sharedConfig].defailtParameters = @{@\"app_version\":[[[NSBundle mainBundle] infoDictionary] objectForKey:@\"CFBundleShortVersionString\"],\n                                                         @\"platform\":@\"iOS\"};\n    \n    [[SJNetworkConfig sharedConfig] addCustomHeader:@{@\"token\":@\"2j4jd9s74bfm9sn3\"}];\n//    [[SJNetworkManager sharedManager] addCustomHeader:@{@\"token\":@\"2j4jd9s74bfm9sn3\"}];\n    \n    return YES;\n}\n\n\n- (void)applicationWillResignActive:(UIApplication *)application {\n    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.\n    // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.\n}\n\n\n- (void)applicationDidEnterBackground:(UIApplication *)application {\n    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.\n    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.\n}\n\n\n- (void)applicationWillEnterForeground:(UIApplication *)application {\n    // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.\n}\n\n\n- (void)applicationDidBecomeActive:(UIApplication *)application {\n    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.\n}\n\n\n- (void)applicationWillTerminate:(UIApplication *)application {\n    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.\n}\n\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/Other/Assets.xcassets/AppIcon.appiconset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"20x20\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"20x20\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"60x60\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"60x60\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"20x20\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"20x20\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"76x76\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"76x76\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"83.5x83.5\",\n      \"scale\" : \"2x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/Other/Base.lproj/LaunchScreen.storyboard",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB\" version=\"3.0\" toolsVersion=\"13122.16\" systemVersion=\"17A277\" targetRuntime=\"iOS.CocoaTouch\" propertyAccessControl=\"none\" useAutolayout=\"YES\" launchScreen=\"YES\" useTraitCollections=\"YES\" useSafeAreas=\"YES\" colorMatched=\"YES\" initialViewController=\"01J-lp-oVM\">\n    <dependencies>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"13104.12\"/>\n        <capability name=\"Safe area layout guides\" minToolsVersion=\"9.0\"/>\n        <capability name=\"documents saved in the Xcode 8 format\" minToolsVersion=\"8.0\"/>\n    </dependencies>\n    <scenes>\n        <!--View Controller-->\n        <scene sceneID=\"EHf-IW-A2E\">\n            <objects>\n                <viewController id=\"01J-lp-oVM\" sceneMemberID=\"viewController\">\n                    <view key=\"view\" contentMode=\"scaleToFill\" id=\"Ze5-6b-2t3\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"375\" height=\"667\"/>\n                        <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n                        <color key=\"backgroundColor\" red=\"1\" green=\"1\" blue=\"1\" alpha=\"1\" colorSpace=\"custom\" customColorSpace=\"sRGB\"/>\n                        <viewLayoutGuide key=\"safeArea\" id=\"6Tk-OE-BBY\"/>\n                    </view>\n                </viewController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"iYj-Kq-Ea1\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n            <point key=\"canvasLocation\" x=\"53\" y=\"375\"/>\n        </scene>\n    </scenes>\n</document>\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/Other/Base.lproj/Main.storyboard",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB\" version=\"3.0\" toolsVersion=\"13529\" targetRuntime=\"iOS.CocoaTouch\" propertyAccessControl=\"none\" useAutolayout=\"YES\" useTraitCollections=\"YES\" useSafeAreas=\"YES\" colorMatched=\"YES\" initialViewController=\"FQf-ps-Fnb\">\n    <device id=\"retina4_7\" orientation=\"portrait\">\n        <adaptation id=\"fullscreen\"/>\n    </device>\n    <dependencies>\n        <deployment identifier=\"iOS\"/>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"13527\"/>\n        <capability name=\"Safe area layout guides\" minToolsVersion=\"9.0\"/>\n        <capability name=\"documents saved in the Xcode 8 format\" minToolsVersion=\"8.0\"/>\n    </dependencies>\n    <scenes>\n        <!--Tab Bar Controller-->\n        <scene sceneID=\"fjy-yU-0It\">\n            <objects>\n                <tabBarController id=\"FQf-ps-Fnb\" sceneMemberID=\"viewController\">\n                    <tabBar key=\"tabBar\" contentMode=\"scaleToFill\" id=\"Eaa-RF-vQv\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"375\" height=\"49\"/>\n                        <autoresizingMask key=\"autoresizingMask\"/>\n                        <color key=\"backgroundColor\" white=\"0.0\" alpha=\"0.0\" colorSpace=\"calibratedWhite\"/>\n                    </tabBar>\n                    <connections>\n                        <segue destination=\"awk-MR-8rI\" kind=\"relationship\" relationship=\"viewControllers\" id=\"jVr-ij-FMo\"/>\n                        <segue destination=\"gPM-sU-FB7\" kind=\"relationship\" relationship=\"viewControllers\" id=\"wlX-HO-VpJ\"/>\n                        <segue destination=\"cnU-TT-nNu\" kind=\"relationship\" relationship=\"viewControllers\" id=\"xMm-yd-KCv\"/>\n                    </connections>\n                </tabBarController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"yto-t6-Y80\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n            <point key=\"canvasLocation\" x=\"166\" y=\"188\"/>\n        </scene>\n        <!--Upload-->\n        <scene sceneID=\"jF3-Us-CM7\">\n            <objects>\n                <viewController id=\"5Ld-SG-yJp\" customClass=\"UploadViewController\" sceneMemberID=\"viewController\">\n                    <layoutGuides>\n                        <viewControllerLayoutGuide type=\"top\" id=\"2jp-Xl-KwU\"/>\n                        <viewControllerLayoutGuide type=\"bottom\" id=\"Ono-8T-iMW\"/>\n                    </layoutGuides>\n                    <view key=\"view\" contentMode=\"scaleToFill\" id=\"GiJ-Cs-7WZ\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"375\" height=\"667\"/>\n                        <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n                        <subviews>\n                            <progressView opaque=\"NO\" contentMode=\"scaleToFill\" verticalHuggingPriority=\"750\" fixedFrame=\"YES\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"Nlr-gV-BBU\">\n                                <rect key=\"frame\" x=\"50\" y=\"116\" width=\"275\" height=\"2\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                            </progressView>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"MYy-lF-DOe\">\n                                <rect key=\"frame\" x=\"125\" y=\"127\" width=\"125\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"Upload one image\"/>\n                                <connections>\n                                    <action selector=\"uploadOneImage:\" destination=\"5Ld-SG-yJp\" eventType=\"touchUpInside\" id=\"xrN-LV-f72\"/>\n                                </connections>\n                            </button>\n                            <progressView opaque=\"NO\" contentMode=\"scaleToFill\" verticalHuggingPriority=\"750\" fixedFrame=\"YES\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"toh-TI-e0M\">\n                                <rect key=\"frame\" x=\"50\" y=\"325\" width=\"275\" height=\"2\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                            </progressView>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"J7w-ph-UiB\">\n                                <rect key=\"frame\" x=\"116\" y=\"341\" width=\"132\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"Upload two images\"/>\n                                <connections>\n                                    <action selector=\"uploadTwoImages:\" destination=\"5Ld-SG-yJp\" eventType=\"touchUpInside\" id=\"LRg-5Z-oac\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"HRs-aL-TsD\">\n                                <rect key=\"frame\" x=\"130\" y=\"165\" width=\"114\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"reset progress 1 \"/>\n                                <connections>\n                                    <action selector=\"resetOneProgressView:\" destination=\"5Ld-SG-yJp\" eventType=\"touchUpInside\" id=\"tJo-BG-75A\"/>\n                                </connections>\n                            </button>\n                            <label opaque=\"NO\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" fixedFrame=\"YES\" text=\"upload one image\" textAlignment=\"natural\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" adjustsFontSizeToFit=\"NO\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"6nE-Iv-lJf\">\n                                <rect key=\"frame\" x=\"50\" y=\"87\" width=\"122\" height=\"21\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"15\"/>\n                                <nil key=\"textColor\"/>\n                                <nil key=\"highlightedColor\"/>\n                            </label>\n                            <label opaque=\"NO\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" fixedFrame=\"YES\" text=\"upload 2 images\" textAlignment=\"natural\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" adjustsFontSizeToFit=\"NO\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"bzD-sz-6aE\">\n                                <rect key=\"frame\" x=\"48\" y=\"296\" width=\"126\" height=\"21\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"15\"/>\n                                <nil key=\"textColor\"/>\n                                <nil key=\"highlightedColor\"/>\n                            </label>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"Y1x-qZ-M9K\">\n                                <rect key=\"frame\" x=\"124\" y=\"379\" width=\"116\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"reset progress 2 \"/>\n                                <connections>\n                                    <action selector=\"resetTwoProgressView:\" destination=\"5Ld-SG-yJp\" eventType=\"touchUpInside\" id=\"ON9-96-yWk\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"YsE-Dp-feK\">\n                                <rect key=\"frame\" x=\"101\" y=\"203\" width=\"172\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"cancel progress1 request\"/>\n                                <connections>\n                                    <action selector=\"cancelProgress1Requst:\" destination=\"5Ld-SG-yJp\" eventType=\"touchUpInside\" id=\"wEn-ih-rLq\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"Oat-Sa-QYY\">\n                                <rect key=\"frame\" x=\"96\" y=\"413\" width=\"177\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"Cancel progress2 request\"/>\n                                <connections>\n                                    <action selector=\"cancelProgress2Request:\" destination=\"5Ld-SG-yJp\" eventType=\"touchUpInside\" id=\"vYw-N1-WZc\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"6d4-WT-720\">\n                                <rect key=\"frame\" x=\"96\" y=\"451\" width=\"182\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"cancel all current requests\"/>\n                                <connections>\n                                    <action selector=\"cancelAllRequests:\" destination=\"5Ld-SG-yJp\" eventType=\"touchUpInside\" id=\"lYE-4k-TeG\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"evQ-3B-nxH\">\n                                <rect key=\"frame\" x=\"101\" y=\"489\" width=\"158\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"log all current requests\"/>\n                                <connections>\n                                    <action selector=\"logAllCurrentRequest:\" destination=\"5Ld-SG-yJp\" eventType=\"touchUpInside\" id=\"rrn-Z2-CxI\"/>\n                                </connections>\n                            </button>\n                        </subviews>\n                        <color key=\"backgroundColor\" white=\"1\" alpha=\"1\" colorSpace=\"calibratedWhite\"/>\n                        <viewLayoutGuide key=\"safeArea\" id=\"g3e-YY-SS9\"/>\n                    </view>\n                    <tabBarItem key=\"tabBarItem\" title=\"Upload\" id=\"4sT-Ly-vkf\"/>\n                    <navigationItem key=\"navigationItem\" title=\"Upload\" id=\"fae-N2-5WA\"/>\n                    <connections>\n                        <outlet property=\"uploadOneImageProgress\" destination=\"Nlr-gV-BBU\" id=\"7dq-dz-Jnk\"/>\n                        <outlet property=\"uploadTwoImageProgress\" destination=\"toh-TI-e0M\" id=\"9kj-PR-DtZ\"/>\n                    </connections>\n                </viewController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"qX8-fj-p1v\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n            <point key=\"canvasLocation\" x=\"2158\" y=\"188\"/>\n        </scene>\n        <!--Upload-->\n        <scene sceneID=\"SfJ-Go-lTk\">\n            <objects>\n                <navigationController id=\"gPM-sU-FB7\" sceneMemberID=\"viewController\">\n                    <tabBarItem key=\"tabBarItem\" title=\"Upload\" id=\"o3z-8v-4lI\"/>\n                    <navigationBar key=\"navigationBar\" contentMode=\"scaleToFill\" id=\"XDa-J7-6jI\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"20\" width=\"375\" height=\"44\"/>\n                        <autoresizingMask key=\"autoresizingMask\"/>\n                    </navigationBar>\n                    <connections>\n                        <segue destination=\"5Ld-SG-yJp\" kind=\"relationship\" relationship=\"rootViewController\" id=\"QkY-My-mCr\"/>\n                    </connections>\n                </navigationController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"Q1i-yw-WxA\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n            <point key=\"canvasLocation\" x=\"1209\" y=\"188\"/>\n        </scene>\n        <!--DownLoad-->\n        <scene sceneID=\"a9T-Wo-DM4\">\n            <objects>\n                <viewController id=\"sXF-cV-rl6\" customClass=\"DownLoadViewController\" sceneMemberID=\"viewController\">\n                    <layoutGuides>\n                        <viewControllerLayoutGuide type=\"top\" id=\"NNm-br-UKc\"/>\n                        <viewControllerLayoutGuide type=\"bottom\" id=\"v71-jp-4L9\"/>\n                    </layoutGuides>\n                    <view key=\"view\" contentMode=\"scaleToFill\" id=\"mb0-Aw-3IY\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"375\" height=\"667\"/>\n                        <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n                        <subviews>\n                            <progressView opaque=\"NO\" contentMode=\"scaleToFill\" verticalHuggingPriority=\"750\" fixedFrame=\"YES\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"ICu-T9-AWD\">\n                                <rect key=\"frame\" x=\"25\" y=\"113\" width=\"320\" height=\"2\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                            </progressView>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"U3w-Fp-oDU\">\n                                <rect key=\"frame\" x=\"28\" y=\"123\" width=\"32\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"start\"/>\n                                <connections>\n                                    <action selector=\"startResumableDownload:\" destination=\"sXF-cV-rl6\" eventType=\"touchUpInside\" id=\"dCz-TR-JEw\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"kCl-IH-yCK\">\n                                <rect key=\"frame\" x=\"98\" y=\"123\" width=\"59\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"suspend\"/>\n                                <connections>\n                                    <action selector=\"suspendResumableDownload:\" destination=\"sXF-cV-rl6\" eventType=\"touchUpInside\" id=\"xIZ-bg-vlU\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"Qbv-ra-7dE\">\n                                <rect key=\"frame\" x=\"202\" y=\"123\" width=\"46\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"restart\"/>\n                                <connections>\n                                    <action selector=\"restartResumableDownload:\" destination=\"sXF-cV-rl6\" eventType=\"touchUpInside\" id=\"r7V-hL-vbQ\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"4ev-Hl-EyZ\">\n                                <rect key=\"frame\" x=\"292\" y=\"123\" width=\"45\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"cancel\"/>\n                                <connections>\n                                    <action selector=\"cancelResumableDownload:\" destination=\"sXF-cV-rl6\" eventType=\"touchUpInside\" id=\"YtO-kL-Eo5\"/>\n                                </connections>\n                            </button>\n                            <label opaque=\"NO\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" fixedFrame=\"YES\" text=\"resumable &amp; none background downoad support\" textAlignment=\"natural\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" adjustsFontSizeToFit=\"NO\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"Bye-XO-Z1c\">\n                                <rect key=\"frame\" x=\"30\" y=\"84\" width=\"315\" height=\"21\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"14\"/>\n                                <nil key=\"textColor\"/>\n                                <nil key=\"highlightedColor\"/>\n                            </label>\n                            <label opaque=\"NO\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" fixedFrame=\"YES\" text=\"resumable &amp; background download support\" textAlignment=\"natural\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" adjustsFontSizeToFit=\"NO\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"HaM-TN-if6\">\n                                <rect key=\"frame\" x=\"30\" y=\"308\" width=\"304\" height=\"21\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"14\"/>\n                                <nil key=\"textColor\"/>\n                                <nil key=\"highlightedColor\"/>\n                            </label>\n                            <label opaque=\"NO\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" fixedFrame=\"YES\" text=\"none resumable &amp; background download support\" textAlignment=\"natural\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" adjustsFontSizeToFit=\"NO\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"bjy-kt-QpG\">\n                                <rect key=\"frame\" x=\"26\" y=\"413\" width=\"319\" height=\"21\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"14\"/>\n                                <nil key=\"textColor\"/>\n                                <nil key=\"highlightedColor\"/>\n                            </label>\n                            <progressView opaque=\"NO\" contentMode=\"scaleToFill\" verticalHuggingPriority=\"750\" fixedFrame=\"YES\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"afq-LM-E6U\">\n                                <rect key=\"frame\" x=\"21\" y=\"229\" width=\"320\" height=\"2\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                            </progressView>\n                            <label opaque=\"NO\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" fixedFrame=\"YES\" text=\"none resumable &amp;&amp; none background download support\" textAlignment=\"natural\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" adjustsFontSizeToFit=\"NO\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"PtR-rM-da5\">\n                                <rect key=\"frame\" x=\"5\" y=\"200\" width=\"364\" height=\"21\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"14\"/>\n                                <nil key=\"textColor\"/>\n                                <nil key=\"highlightedColor\"/>\n                            </label>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"siX-jF-hHQ\">\n                                <rect key=\"frame\" x=\"26\" y=\"239\" width=\"32\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"start\"/>\n                                <connections>\n                                    <action selector=\"startNoneResumableDownload:\" destination=\"sXF-cV-rl6\" eventType=\"touchUpInside\" id=\"c4b-wn-Fac\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"l0T-xU-OxR\">\n                                <rect key=\"frame\" x=\"94\" y=\"239\" width=\"59\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"suspend\"/>\n                                <connections>\n                                    <action selector=\"suspendNoneResumableDownload:\" destination=\"sXF-cV-rl6\" eventType=\"touchUpInside\" id=\"hbw-2J-3JO\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"4Oc-dj-Fn5\">\n                                <rect key=\"frame\" x=\"198\" y=\"239\" width=\"46\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"restart\"/>\n                                <connections>\n                                    <action selector=\"restartNoneResumableDownload:\" destination=\"sXF-cV-rl6\" eventType=\"touchUpInside\" id=\"dAs-2g-imH\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"YXd-kw-APS\">\n                                <rect key=\"frame\" x=\"288\" y=\"239\" width=\"45\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"cancel\"/>\n                                <connections>\n                                    <action selector=\"cancelNoneResumableDownload:\" destination=\"sXF-cV-rl6\" eventType=\"touchUpInside\" id=\"EAD-RS-E2o\"/>\n                                </connections>\n                            </button>\n                            <progressView opaque=\"NO\" contentMode=\"scaleToFill\" verticalHuggingPriority=\"750\" fixedFrame=\"YES\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"D9n-89-LYG\">\n                                <rect key=\"frame\" x=\"21\" y=\"337\" width=\"313\" height=\"3\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                            </progressView>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"uvH-z6-fET\">\n                                <rect key=\"frame\" x=\"25\" y=\"348\" width=\"32\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"start\"/>\n                                <connections>\n                                    <action selector=\"startResumableBackgroundDownload:\" destination=\"sXF-cV-rl6\" eventType=\"touchUpInside\" id=\"Mba-ga-cwh\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"uqM-Ka-51e\">\n                                <rect key=\"frame\" x=\"92\" y=\"348\" width=\"59\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"suspend\"/>\n                                <connections>\n                                    <action selector=\"suspendResumableBackgroundDownload:\" destination=\"sXF-cV-rl6\" eventType=\"touchUpInside\" id=\"ZdL-xQ-oYX\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"MKJ-3Y-kkL\">\n                                <rect key=\"frame\" x=\"196\" y=\"348\" width=\"46\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"restart\"/>\n                                <connections>\n                                    <action selector=\"restartResumableBackgroundDownload:\" destination=\"sXF-cV-rl6\" eventType=\"touchUpInside\" id=\"zfP-Va-BPt\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"tPR-dj-6xD\">\n                                <rect key=\"frame\" x=\"286\" y=\"348\" width=\"45\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"cancel\"/>\n                                <connections>\n                                    <action selector=\"cancelResumableBackgroundDownload:\" destination=\"sXF-cV-rl6\" eventType=\"touchUpInside\" id=\"xXs-zk-mdX\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"srO-Um-zVj\">\n                                <rect key=\"frame\" x=\"106\" y=\"571\" width=\"158\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"log all current requests\"/>\n                                <connections>\n                                    <action selector=\"logAllCurrentRequests:\" destination=\"sXF-cV-rl6\" eventType=\"touchUpInside\" id=\"KEL-GO-Fs6\"/>\n                                </connections>\n                            </button>\n                            <progressView opaque=\"NO\" contentMode=\"scaleToFill\" verticalHuggingPriority=\"750\" fixedFrame=\"YES\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"CKA-Ca-C9X\">\n                                <rect key=\"frame\" x=\"20\" y=\"442\" width=\"312\" height=\"2\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                            </progressView>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"GSq-mi-nR8\">\n                                <rect key=\"frame\" x=\"21\" y=\"452\" width=\"32\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"start\"/>\n                                <connections>\n                                    <action selector=\"startNoneResumableBackgroundDownload:\" destination=\"sXF-cV-rl6\" eventType=\"touchUpInside\" id=\"tt6-sm-gPY\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"UNP-jS-Eh3\">\n                                <rect key=\"frame\" x=\"95\" y=\"452\" width=\"59\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"suspend\"/>\n                                <connections>\n                                    <action selector=\"suspendNoneResumableBackgroundDownload:\" destination=\"sXF-cV-rl6\" eventType=\"touchUpInside\" id=\"Nyg-ci-i3f\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"6jQ-h7-Xbw\">\n                                <rect key=\"frame\" x=\"200\" y=\"452\" width=\"46\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"restart\"/>\n                                <connections>\n                                    <action selector=\"restartNoneResumableBackgroundDownload:\" destination=\"sXF-cV-rl6\" eventType=\"touchUpInside\" id=\"u6N-Cq-wr7\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"Ngb-9P-afc\">\n                                <rect key=\"frame\" x=\"289\" y=\"452\" width=\"45\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"cancel\"/>\n                                <connections>\n                                    <action selector=\"cancelNoneResumableBackgroundDownload:\" destination=\"sXF-cV-rl6\" eventType=\"touchUpInside\" id=\"Td2-ic-vva\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"ud1-yj-sgC\">\n                                <rect key=\"frame\" x=\"22\" y=\"513\" width=\"78\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"suspend all\"/>\n                                <connections>\n                                    <action selector=\"suspendAllDownloadRequests:\" destination=\"sXF-cV-rl6\" eventType=\"touchUpInside\" id=\"ZJX-rS-SYX\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"2Sl-gn-hVv\">\n                                <rect key=\"frame\" x=\"143\" y=\"513\" width=\"71\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"resume all\"/>\n                                <connections>\n                                    <action selector=\"resumeAllDownloadRequests:\" destination=\"sXF-cV-rl6\" eventType=\"touchUpInside\" id=\"wgO-rG-0fo\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"x0t-7c-Wnm\">\n                                <rect key=\"frame\" x=\"270\" y=\"513\" width=\"64\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"cancel all\"/>\n                                <connections>\n                                    <action selector=\"cancelAllDownloadRequests:\" destination=\"sXF-cV-rl6\" eventType=\"touchUpInside\" id=\"KRf-n5-7mT\"/>\n                                </connections>\n                            </button>\n                        </subviews>\n                        <color key=\"backgroundColor\" white=\"1\" alpha=\"1\" colorSpace=\"calibratedWhite\"/>\n                        <viewLayoutGuide key=\"safeArea\" id=\"qJl-oW-Eso\"/>\n                    </view>\n                    <tabBarItem key=\"tabBarItem\" title=\"DownLoad\" id=\"cig-lu-HPK\"/>\n                    <navigationItem key=\"navigationItem\" title=\"DownLoad\" id=\"H4s-hG-aiZ\"/>\n                    <connections>\n                        <outlet property=\"progress_none_resumable\" destination=\"afq-LM-E6U\" id=\"qPU-JX-qtj\"/>\n                        <outlet property=\"progress_none_resumable_background\" destination=\"CKA-Ca-C9X\" id=\"Y2S-yW-tTb\"/>\n                        <outlet property=\"progress_resumable\" destination=\"ICu-T9-AWD\" id=\"uLr-ce-B9k\"/>\n                        <outlet property=\"progress_resumable_background\" destination=\"D9n-89-LYG\" id=\"8sx-jN-03P\"/>\n                    </connections>\n                </viewController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"wsc-6D-4hQ\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n            <point key=\"canvasLocation\" x=\"2158\" y=\"1075\"/>\n        </scene>\n        <!--Download-->\n        <scene sceneID=\"N1J-30-x7f\">\n            <objects>\n                <navigationController id=\"cnU-TT-nNu\" sceneMemberID=\"viewController\">\n                    <tabBarItem key=\"tabBarItem\" title=\"Download\" id=\"vqe-5d-aA8\"/>\n                    <navigationBar key=\"navigationBar\" contentMode=\"scaleToFill\" id=\"hpX-75-LT0\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"20\" width=\"375\" height=\"44\"/>\n                        <autoresizingMask key=\"autoresizingMask\"/>\n                    </navigationBar>\n                    <connections>\n                        <segue destination=\"sXF-cV-rl6\" kind=\"relationship\" relationship=\"rootViewController\" id=\"YkB-se-pPn\"/>\n                    </connections>\n                </navigationController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"kCq-Gb-WoZ\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n            <point key=\"canvasLocation\" x=\"1209\" y=\"1075\"/>\n        </scene>\n        <!--GET&POST-->\n        <scene sceneID=\"dXa-G2-NaM\">\n            <objects>\n                <viewController id=\"aRl-YX-zWG\" customClass=\"ViewController\" sceneMemberID=\"viewController\">\n                    <layoutGuides>\n                        <viewControllerLayoutGuide type=\"top\" id=\"7uL-3U-kgl\"/>\n                        <viewControllerLayoutGuide type=\"bottom\" id=\"C83-am-duP\"/>\n                    </layoutGuides>\n                    <view key=\"view\" contentMode=\"scaleToFill\" id=\"0Mx-wX-GVZ\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"375\" height=\"667\"/>\n                        <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n                        <subviews>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" verticalCompressionResistancePriority=\"752\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"CXw-R8-1xe\">\n                                <rect key=\"frame\" x=\"50\" y=\"70\" width=\"277\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"send request_1 &amp; not write or load cache\"/>\n                                <connections>\n                                    <action selector=\"sendRequest_1_not_load_cache:\" destination=\"aRl-YX-zWG\" eventType=\"touchUpInside\" id=\"IOf-Zo-V8V\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" verticalCompressionResistancePriority=\"751\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"GqI-zw-3L0\">\n                                <rect key=\"frame\" x=\"32\" y=\"95\" width=\"306\" height=\"48\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\">\n                                    <string key=\"title\">send request_1  &amp; save cache not load cache\n&amp;sdf</string>\n                                </state>\n                                <connections>\n                                    <action selector=\"sendRequest_1_save_cache:\" destination=\"aRl-YX-zWG\" eventType=\"touchUpInside\" id=\"2zP-Fi-5ao\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"bYa-WW-VIR\">\n                                <rect key=\"frame\" x=\"55\" y=\"130\" width=\"266\" height=\"48\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"send request_1  &amp; write and load cache\"/>\n                                <connections>\n                                    <action selector=\"sendRequest_1_load_cache:\" destination=\"aRl-YX-zWG\" eventType=\"touchUpInside\" id=\"wtV-mK-j65\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"pHv-19-25e\">\n                                <rect key=\"frame\" x=\"20\" y=\"263\" width=\"348\" height=\"48\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\">\n                                    <string key=\"title\">send request_1,request_2 &amp; not write or load cache\n</string>\n                                </state>\n                                <connections>\n                                    <action selector=\"sendRequest_1_request_2_not_load_cache:\" destination=\"aRl-YX-zWG\" eventType=\"touchUpInside\" id=\"R7i-sp-7SY\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" verticalCompressionResistancePriority=\"752\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"oBj-kA-VyS\">\n                                <rect key=\"frame\" x=\"103\" y=\"418\" width=\"182\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"cancel all current reqeusts\"/>\n                                <connections>\n                                    <action selector=\"cancel_all_current_requests:\" destination=\"aRl-YX-zWG\" eventType=\"touchUpInside\" id=\"4Bh-J9-Yzx\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" verticalHuggingPriority=\"254\" verticalCompressionResistancePriority=\"751\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"uGk-jk-Enn\">\n                                <rect key=\"frame\" x=\"60\" y=\"311\" width=\"268\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"send request_1,request_2 &amp; save cache\"/>\n                                <connections>\n                                    <action selector=\"sendRequest_1_request_2_save_cache:\" destination=\"aRl-YX-zWG\" eventType=\"touchUpInside\" id=\"fyD-fp-ndm\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"tCc-LR-QbC\">\n                                <rect key=\"frame\" x=\"54\" y=\"338\" width=\"266\" height=\"48\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\">\n                                    <string key=\"title\">send request_1,request_2 &amp; load cache\n</string>\n                                </state>\n                                <connections>\n                                    <action selector=\"sendRequest_1_request_2_load_cache:\" destination=\"aRl-YX-zWG\" eventType=\"touchUpInside\" id=\"juV-eV-wDq\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"JoT-1v-kGC\">\n                                <rect key=\"frame\" x=\"138\" y=\"611\" width=\"99\" height=\"48\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\">\n                                    <string key=\"title\">clear all cache\n</string>\n                                </state>\n                                <connections>\n                                    <action selector=\"clear_all_cache:\" destination=\"aRl-YX-zWG\" eventType=\"touchUpInside\" id=\"Ddb-kY-wHU\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"TCr-sl-YjX\">\n                                <rect key=\"frame\" x=\"109\" y=\"487\" width=\"158\" height=\"48\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\">\n                                    <string key=\"title\">log all current requests\n</string>\n                                </state>\n                                <connections>\n                                    <action selector=\"log_all_current_requests:\" destination=\"aRl-YX-zWG\" eventType=\"touchUpInside\" id=\"Snf-kC-SVJ\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"EDU-Cx-t7U\">\n                                <rect key=\"frame\" x=\"103\" y=\"526\" width=\"169\" height=\"48\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"if remain current request\"/>\n                                <connections>\n                                    <action selector=\"if_remain_current_requests:\" destination=\"aRl-YX-zWG\" eventType=\"touchUpInside\" id=\"KmA-I9-ytt\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"KM2-E6-gPS\">\n                                <rect key=\"frame\" x=\"87\" y=\"447\" width=\"215\" height=\"48\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\">\n                                    <string key=\"title\">calculate current request count\n</string>\n                                </state>\n                                <connections>\n                                    <action selector=\"calculate_current_request_count:\" destination=\"aRl-YX-zWG\" eventType=\"touchUpInside\" id=\"gjy-cp-gm3\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"sQ4-aF-44d\">\n                                <rect key=\"frame\" x=\"118\" y=\"569\" width=\"138\" height=\"48\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\">\n                                    <string key=\"title\">calculate cache size\n</string>\n                                </state>\n                                <connections>\n                                    <action selector=\"calculate_cache_size:\" destination=\"aRl-YX-zWG\" eventType=\"touchUpInside\" id=\"wy1-KD-tH4\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" verticalHuggingPriority=\"253\" verticalCompressionResistancePriority=\"751\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"0jV-t6-OH3\">\n                                <rect key=\"frame\" x=\"113\" y=\"219\" width=\"151\" height=\"48\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\">\n                                    <string key=\"title\">clear request_1  cache\n</string>\n                                </state>\n                                <connections>\n                                    <action selector=\"clearRequest_1_cache:\" destination=\"aRl-YX-zWG\" eventType=\"touchUpInside\" id=\"EMf-Va-66O\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"LlA-kQ-BbJ\">\n                                <rect key=\"frame\" x=\"114\" y=\"201\" width=\"143\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"load request_1 cache\"/>\n                                <connections>\n                                    <action selector=\"loadRequest_1_cache:\" destination=\"aRl-YX-zWG\" eventType=\"touchUpInside\" id=\"9s6-Tf-5Xd\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" verticalCompressionResistancePriority=\"752\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"oCI-AM-xEJ\">\n                                <rect key=\"frame\" x=\"132\" y=\"163\" width=\"113\" height=\"48\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\">\n                                    <string key=\"title\">cancel reqeust_1 \n</string>\n                                </state>\n                                <connections>\n                                    <action selector=\"cancelRequest_1:\" destination=\"aRl-YX-zWG\" eventType=\"touchUpInside\" id=\"ltf-XA-ZAE\"/>\n                                </connections>\n                            </button>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"WtY-FE-IIp\">\n                                <rect key=\"frame\" x=\"11\" y=\"380\" width=\"331\" height=\"30\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <state key=\"normal\" title=\"send request_1,request_2 &amp; save and load cache\"/>\n                                <connections>\n                                    <action selector=\"sendRequest1_request2_save_load_cache:\" destination=\"aRl-YX-zWG\" eventType=\"touchUpInside\" id=\"0kx-EX-6Od\"/>\n                                </connections>\n                            </button>\n                        </subviews>\n                        <color key=\"backgroundColor\" red=\"1\" green=\"1\" blue=\"1\" alpha=\"1\" colorSpace=\"custom\" customColorSpace=\"sRGB\"/>\n                        <viewLayoutGuide key=\"safeArea\" id=\"Umt-gL-iAr\"/>\n                    </view>\n                    <tabBarItem key=\"tabBarItem\" title=\"GET&amp;POST&amp;PUT&amp;DELETE\" id=\"LGH-Yn-MRu\"/>\n                    <navigationItem key=\"navigationItem\" title=\"GET&amp;POST\" id=\"fyL-yO-lbw\"/>\n                </viewController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"jg1-6V-vIy\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n            <point key=\"canvasLocation\" x=\"2158\" y=\"-592\"/>\n        </scene>\n        <!--GET&POST-->\n        <scene sceneID=\"bs9-mI-ZsT\">\n            <objects>\n                <navigationController id=\"awk-MR-8rI\" sceneMemberID=\"viewController\">\n                    <tabBarItem key=\"tabBarItem\" title=\"GET&amp;POST\" id=\"G7e-wJ-mig\"/>\n                    <navigationBar key=\"navigationBar\" contentMode=\"scaleToFill\" id=\"nNH-if-2vI\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"20\" width=\"375\" height=\"44\"/>\n                        <autoresizingMask key=\"autoresizingMask\"/>\n                    </navigationBar>\n                    <connections>\n                        <segue destination=\"aRl-YX-zWG\" kind=\"relationship\" relationship=\"rootViewController\" id=\"XuX-Uo-Ydd\"/>\n                    </connections>\n                </navigationController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"TyI-cC-Eci\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n            <point key=\"canvasLocation\" x=\"1209\" y=\"-592\"/>\n        </scene>\n    </scenes>\n</document>\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/Other/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>$(DEVELOPMENT_LANGUAGE)</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>NSAppTransportSecurity</key>\n\t<dict>\n\t\t<key>NSAllowsArbitraryLoads</key>\n\t\t<true/>\n\t</dict>\n\t<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>\n\t<key>UIMainStoryboardFile</key>\n\t<string>Main</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>armv7</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations~ipad</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationPortraitUpsideDown</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/Other/main.m",
    "content": "//\n//  main.m\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/23.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n#import \"AppDelegate.h\"\n\nint main(int argc, char * argv[]) {\n    @autoreleasepool {\n        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));\n    }\n}\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetwork.h",
    "content": "//\n//  SJNetwork.h\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/12/27.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#ifndef SJNetwork_h\n#define SJNetwork_h\n\n#import \"SJNetworkManager.h\"\n#import \"SJNetworkConfig.h\"\n\n#endif /* SJNetwork_h */\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkBaseEngine.h",
    "content": "//\n//  SJNetworkBaseEngine.h\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/12/26.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n#import \"SJNetworkRequestModel.h\"\n\n\n@interface SJNetworkBaseEngine : NSObject\n\n\n/**\n *  This method is used to add customed headers, for subclass to override\n */\n- (void)addCustomHeaders;\n\n\n\n/**\n *  This method is used to add default parameters with custom parameters, for subclass to override\n *\n *  @param parameters        custom parameters\n *\n */\n- (id)addDefaultParametersWithCustomParameters:(id)parameters;\n\n\n\n\n/**\n *  This method is used to execute some operation with the request model when the corresponding request succeed, for subclass to override\n *\n *  @param requestModel      request model of a network request\n *\n */\n- (void)requestDidSucceedWithRequestModel:(SJNetworkRequestModel *)requestModel;\n\n\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkBaseEngine.m",
    "content": "//\n//  SJNetworkBaseEngine.m\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/12/26.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"SJNetworkBaseEngine.h\"\n\n@implementation SJNetworkBaseEngine\n\n\n- (void)addCustomHeaders{\n    \n}\n\n\n\n- (id)addDefaultParametersWithCustomParameters:(id)parameters{\n    return nil;\n}\n\n\n\n- (void)requestDidSucceedWithRequestModel:(SJNetworkRequestModel *)requestModel{\n    \n    \n}\n\n\n\n- (void)requestDidFailedWithRequestModel:(SJNetworkRequestModel *)requestModel error:(NSError *)error{\n    \n    \n}\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkCacheInfo.h",
    "content": "//\n//  SJNetworkCacheInfo.h\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/25.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n\n#import <Foundation/Foundation.h>\n\n\n/* =============================\n *\n * SJNetworkCacheInfo\n *\n * SJNetworkCacheInfo is in charge of recording the infomation of cache which is related to a specific network request\n *\n * =============================\n */\n\n@interface SJNetworkCacheInfo : NSObject<NSSecureCoding>\n\n// Record the creation date of the cache\n@property (nonatomic, readwrite, strong) NSDate *creationDate;\n\n// Record the length of the period of validity (unit is second)\n@property (nonatomic, readwrite, strong) NSNumber *cacheDuration;\n\n// Record the app version when the cache is created\n@property (nonatomic, readwrite, copy)   NSString *appVersionStr;\n\n// Record the request identifier of the cache\n@property (nonatomic, readwrite, copy)   NSString *reqeustIdentifer;\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkCacheInfo.m",
    "content": "//\n//  SJNetworkCacheInfo.m\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/25.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"SJNetworkCacheInfo.h\"\n\n@implementation SJNetworkCacheInfo\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n- (void)encodeWithCoder:(NSCoder *)aCoder{\n    \n    [aCoder encodeObject:self.cacheDuration forKey:NSStringFromSelector(@selector(cacheDuration))];\n    [aCoder encodeObject:self.creationDate forKey:NSStringFromSelector(@selector(creationDate))];\n    [aCoder encodeObject:self.appVersionStr forKey:NSStringFromSelector(@selector(appVersionStr))];\n    [aCoder encodeObject:self.reqeustIdentifer forKey:NSStringFromSelector(@selector(reqeustIdentifer))];\n}\n\n- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder {\n    \n    self = [self init];\n    \n    if (self) {\n        \n        self.cacheDuration = [aDecoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(cacheDuration))];\n        self.creationDate = [aDecoder decodeObjectOfClass:[NSDate class] forKey:NSStringFromSelector(@selector(creationDate))];\n        self.appVersionStr = [aDecoder decodeObjectOfClass:[NSString class] forKey:NSStringFromSelector(@selector(appVersionStr))];\n        self.reqeustIdentifer = [aDecoder decodeObjectOfClass:[NSString class] forKey:NSStringFromSelector(@selector(reqeustIdentifer))];\n    }\n\n    return self;\n}\n\n- (NSString *)description{\n\n    return [NSString stringWithFormat:@\"{cacheDuration:%@},{creationDate:%@},{appVersion:%@},{requestIdentifer:%@}\",_cacheDuration,_creationDate,_appVersionStr,_reqeustIdentifer];\n}\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkCacheManager.h",
    "content": "//\n//  SJNetworkCache.h\n//  SJNetwork\n//\n//  Created by Sun Shijie on 2017/8/16.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n\n@class SJNetworkRequestModel;\n@class SJNetworkDownloadResumeDataInfo;\n\n\n// Callback when the cache is cleared\ntypedef void(^SJClearCacheCompletionBlock)(BOOL isSuccess);\n\n// Callback when the cache is loaded\ntypedef void(^SJLoadCacheCompletionBlock)(id _Nullable cacheObject);\n\n// Callback when cache array is loaded\ntypedef void(^SJLoadCacheArrCompletionBlock)(NSArray * _Nullable cacheArr);\n\n// Callback when the size of cache is calculated\ntypedef void(^SJCalculateSizeCompletionBlock)(NSUInteger fileCount, NSUInteger totalSize, NSString * _Nonnull totalSizeString);\n\n\n\n/* =============================\n *\n * SJNetworkCacheManager\n *\n * SJNetworkCacheManager is in charge of managing operations of oridinary request cache(and cache info) and resume data (and resume data info)of a certain download request\n *\n * =============================\n */\n\n@interface SJNetworkCacheManager : NSObject\n\n\n\n/**\n *  SJNetworkCacheManager Singleton\n *\n *  @return SJNetworkCacheManager singleton instance\n */\n+ (SJNetworkCacheManager *_Nonnull)sharedManager;\n\n\n\n\n\n//============================ Write Cache ============================//\n\n/**\n *  This method is used to write cache(cache data and cache info), \n    can only be called by SJNetworkManager instance\n *\n *  @param requestModel        the model holds the configuration of a specific request\n *  @param asynchronously      if write cache asynchronously\n *\n */\n- (void)writeCacheWithReqeustModel:(SJNetworkRequestModel * _Nonnull)requestModel asynchronously:(BOOL)asynchronously;\n\n\n\n\n//============================= Load cache =============================//\n\n\n/**\n *  This method is used to load cache which is related to a specific url,\n    no matter what request method is or parameters are\n *\n *\n *  @param url                  the url of related network requests\n *  @param completionBlock      callback\n *\n */\n- (void)loadCacheWithUrl:(NSString * _Nonnull)url completionBlock:(SJLoadCacheArrCompletionBlock _Nullable)completionBlock;\n\n\n\n\n- (void)loadCacheWithUrl:(NSString * _Nonnull)url\n                  method:(NSString * _Nonnull)method\n         completionBlock:(SJLoadCacheArrCompletionBlock _Nullable)completionBlock;\n\n\n\n/**\n *  This method is used to load cache which is related to a specific url,method and parameters\n *\n *  @param url                  the url of the network request\n *  @param method               the method of the network request\n *  @param parameters           the parameters of the network request\n *  @param completionBlock      callback\n *\n */\n- (void)loadCacheWithUrl:(NSString * _Nonnull)url\n                  method:(NSString * _Nonnull)method\n              parameters:(id _Nullable)parameters\n         completionBlock:(SJLoadCacheCompletionBlock _Nullable)completionBlock;\n\n\n\n\n\n/**\n *  This method is used to load cache which is related to a identier which is the unique to a network request,\n    can only be called by SJNetworkManager instance\n *\n *  @param requestIdentifer     the unique identier of a specific  network request\n *  @param completionBlock      callback\n *\n */\n- (void)loadCacheWithRequestIdentifer:(NSString * _Nonnull)requestIdentifer completionBlock:(SJLoadCacheCompletionBlock _Nullable)completionBlock;\n\n\n\n\n\n//============================ calculate cache ============================//\n\n/**\n *  This method is used to calculate the size of the cache folder (include ordinary request cache and download resume data file and resume data info file)\n *\n *  @param completionBlock      finish callback\n *\n */\n- (void)calculateAllCacheSizecompletionBlock:(SJCalculateSizeCompletionBlock _Nullable)completionBlock;\n\n\n\n\n\n//============================== clear cache ==============================//\n\n/**\n *  This method is used to clear all cache which is in the cache folder\n *\n *  @param completionBlock      callback\n *\n */\n- (void)clearAllCacheCompletionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock;\n\n\n\n\n/**\n *  This method is used to clear the cache which is related the specific url,\n    no matter what request method is or parameters are\n *\n *  @param url                   the url of network request\n *  @param completionBlock       callback\n *\n */\n- (void)clearCacheWithUrl:(NSString * _Nonnull)url completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock;\n\n\n\n\n- (void)clearCacheWithUrl:(NSString * _Nonnull)url\n                   method:(NSString * _Nonnull)method\n          completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock;\n\n\n/**\n *  This method is used to clear cache which is related to a specific url,method and parameters\n *\n *  @param url                  the url of the network request\n *  @param method               the method of the network request\n *  @param parameters           the parameters of the network request\n *  @param completionBlock      callback\n *\n */\n- (void)clearCacheWithUrl:(NSString * _Nonnull)url\n                   method:(NSString * _Nonnull)method\n               parameters:(id _Nullable)parameters\n          completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock;\n\n\n\n//============================== Update resume data or resume data info ==============================//\n\n/**\n *  This method is used to update resume data info after suspending a download request\n *\n *  @param requestModel      request model of a network requst\n *\n */\n- (void)updateResumeDataInfoAfterSuspendWithRequestModel:(SJNetworkRequestModel *_Nonnull)requestModel;\n\n\n\n\n/**\n *  This method is used to remove resume data and resume data info files\n *\n *  @param requestModel      request model of a network requst\n *\n */\n- (void)removeResumeDataAndResumeDataInfoFileWithRequestModel:(SJNetworkRequestModel *_Nonnull)requestModel;\n\n\n\n\n\n/**\n *  This method is used to remove download data to target download file path and clear the resume data info file\n *\n *  @param requestModel      request model of a network requst\n *\n */\n- (void)removeCompleteDownloadDataAndClearResumeDataInfoFileWithRequestModel:(SJNetworkRequestModel *_Nonnull)requestModel;\n\n\n\n\n//============================== Load resume data info ==============================//\n\n/**\n *  This method is used to load resume data info in a given file path\n *\n *  @param filePath          file path\n *\n */\n- (SJNetworkDownloadResumeDataInfo *_Nullable)loadResumeDataInfo:(NSString *_Nonnull)filePath;\n\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkCacheManager.m",
    "content": "//\n//  SJNetworkCache.m\n//  SJNetwork\n//\n//  Created by Sun Shijie on 2017/8/16.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"SJNetworkCacheManager.h\"\n#import \"SJNetworkRequestModel.h\"\n#import \"SJNetworkConfig.h\"\n#import \"SJNetworkUtils.h\"\n#import \"SJNetworkCacheInfo.h\"\n#import \"SJNetworkDownloadResumeDataInfo.h\"\n\n\n\n#ifndef NSFoundationVersionNumber_iOS_8_0\n#define NSFoundationVersionNumber_With_QoS_Available 1140.11\n#else\n#define NSFoundationVersionNumber_With_QoS_Available NSFoundationVersionNumber_iOS_8_0\n#endif\n\n\nstatic dispatch_queue_t sj_cache_io_queue() {\n    \n    static dispatch_queue_t queue;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        dispatch_queue_attr_t attr = DISPATCH_QUEUE_SERIAL;\n        if (NSFoundationVersionNumber >= NSFoundationVersionNumber_With_QoS_Available) {\n            attr = dispatch_queue_attr_make_with_qos_class(attr, QOS_CLASS_BACKGROUND, 0);\n        }\n        queue = dispatch_queue_create(\"com.sj.caching.io\", attr);\n    });\n    \n    return queue;\n}\n\n\n\n\n\n@implementation SJNetworkCacheManager{\n    \n    NSFileManager *_fileManager;\n    NSString *_cacheBasePath;\n    BOOL _isDebugMode;\n}\n\n\n#pragma mark- ============== Life Cycle Methods ==============\n\n\n+ (SJNetworkCacheManager *_Nonnull)sharedManager{\n    \n    static SJNetworkCacheManager *sharedManager = nil;\n    static dispatch_once_t onceToken;\n    \n    dispatch_once(&onceToken, ^{\n        sharedManager = [[SJNetworkCacheManager alloc] init];\n    });\n    return sharedManager;\n}\n\n\n- (instancetype)init{\n    \n    self = [super init];\n    if (self) {\n        \n        _fileManager = [NSFileManager defaultManager];\n        _cacheBasePath = [SJNetworkUtils createCacheBasePath];\n        _isDebugMode = [SJNetworkConfig sharedConfig].debugMode;\n        \n    }\n    return self;\n}\n\n//==================== Write Cache ====================//\n\n#pragma mark- ============== Public Methods ==============\n\n\n#pragma mark Write Cache\n\n- (void)writeCacheWithReqeustModel:(SJNetworkRequestModel * _Nonnull)requestModel asynchronously:(BOOL)asynchronously{\n    \n    \n    if (asynchronously) {\n        \n        dispatch_async(sj_cache_io_queue(), ^{\n            [self p_wrtieCacheWithRequestModel:requestModel];\n        });\n        \n    }else{\n        \n        [self p_wrtieCacheWithRequestModel:requestModel];\n    }\n}\n\n\n\n#pragma mark Load Cache\n\n\n\n- (void)loadCacheWithUrl:(NSString * _Nonnull)url completionBlock:(SJLoadCacheArrCompletionBlock _Nullable)completionBlock{\n    \n    NSString *partialIdentifier = [SJNetworkUtils generatePartialIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                           requestUrlStr:url\n                                                                               methodStr:nil];\n    \n    [self p_loadCacheWithPartialIdentifier:partialIdentifier completionBlock:completionBlock];\n\n}\n\n\n- (void)loadCacheWithUrl:(NSString * _Nonnull)url\n                  method:(NSString * _Nonnull)method\n         completionBlock:(SJLoadCacheArrCompletionBlock _Nullable)completionBlock{\n    \n    \n    NSString *partialIdentifier = [SJNetworkUtils generatePartialIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                           requestUrlStr:url\n                                                                               methodStr:method];\n    \n    [self p_loadCacheWithPartialIdentifier:partialIdentifier completionBlock:completionBlock];\n    \n}\n\n\n\n\n- (void)loadCacheWithUrl:(NSString * _Nonnull)url\n                  method:(NSString * _Nonnull)method\n              parameters:(id _Nullable)parameters\n         completionBlock:(SJLoadCacheCompletionBlock _Nullable)completionBlock{\n\n    NSString *requestIdentifer = [SJNetworkUtils generateRequestIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                          requestUrlStr:url\n                                                                              methodStr:method\n                                                                             parameters:parameters];\n    \n    [self loadCacheWithRequestIdentifer:requestIdentifer completionBlock:^(NSArray * _Nullable cacheArr) {\n        \n        if (completionBlock) {\n            completionBlock(cacheArr);\n        }\n    \n    }];\n    \n}\n\n\n\n- (void)loadCacheWithRequestIdentifer:(NSString * _Nonnull)requestIdentifer\n                      completionBlock:(SJLoadCacheCompletionBlock _Nullable)completionBlock{\n    \n    NSString *cacheDataFilePath = [SJNetworkUtils cacheDataFilePathWithRequestIdentifer:requestIdentifer];\n    NSString *cacheInfoFilePath = [SJNetworkUtils cacheDataInfoFilePathWithRequestIdentifer:requestIdentifer];\n    \n    //load cache info\n    SJNetworkCacheInfo *cacheInfo = [self p_loadCacheInfoWithRequestIdentifier:requestIdentifer];\n    \n    if (!cacheInfo) {\n        \n        if (_isDebugMode) {\n            SJLog(@\"=========== Load cache failed: Cache info dose not exists in path:%@\",cacheInfoFilePath);\n        }\n        \n        [self removeCacheDataFile:cacheDataFilePath cacheInfoFile:cacheInfoFilePath];\n        \n        dispatch_async(dispatch_get_main_queue(), ^{\n            if (completionBlock) {\n                completionBlock(nil);\n            }\n        });\n        \n        return;\n    }\n    \n    BOOL cacheValidation = [self p_checkCacheValidation:cacheInfo];\n    \n    if (!cacheValidation) {\n        \n        if (_isDebugMode) {\n            SJLog(@\"=========== Load cache failed: Cache info is invalid\");\n        }\n        \n        [self removeCacheDataFile:cacheDataFilePath cacheInfoFile:cacheInfoFilePath];\n        \n        \n        dispatch_async(dispatch_get_main_queue(), ^{\n            if (completionBlock) {\n                completionBlock(nil);\n            }\n        });\n        \n        return;\n        \n    }\n    \n    id cacheObject = [self p_loadCacheObjectWithCacheFilePath:cacheDataFilePath];\n    \n    if (!cacheObject) {\n        \n        if (_isDebugMode) {\n            SJLog(@\"=========== Load cache failed: Cache data is missing\");\n        }\n        \n        [self removeCacheDataFile:cacheDataFilePath cacheInfoFile:cacheInfoFilePath];\n        \n        dispatch_async(dispatch_get_main_queue(), ^{\n            if (completionBlock) {\n                completionBlock(nil);\n            }\n        });\n        \n        return;\n        \n    }else {\n        \n        \n        if (_isDebugMode) {\n            SJLog(@\"=========== Load cache succeed: Cache loacation:%@\",cacheDataFilePath);\n        }\n        \n        dispatch_async(dispatch_get_main_queue(), ^{\n            if (completionBlock) {\n                completionBlock(cacheObject);\n            }\n        });\n    }\n}\n\n\n\n\n#pragma mark Calculate Cache\n\n- (void)calculateAllCacheSizecompletionBlock:(SJCalculateSizeCompletionBlock _Nullable)completionBlock{\n\n    NSURL *diskCacheURL = [NSURL fileURLWithPath:_cacheBasePath isDirectory:YES];\n    \n    dispatch_async(sj_cache_io_queue(), ^{\n        \n        NSUInteger fileCount = 0;\n        NSUInteger totalSize = 0;\n        \n        NSDirectoryEnumerator *fileEnumerator = [_fileManager enumeratorAtURL:diskCacheURL\n                                                   includingPropertiesForKeys:@[NSFileSize]\n                                                                      options:NSDirectoryEnumerationSkipsHiddenFiles\n                                                                 errorHandler:NULL];\n        \n        for (NSURL *fileURL in fileEnumerator) {\n            NSNumber *fileSize;\n            [fileURL getResourceValue:&fileSize forKey:NSURLFileSizeKey error:NULL];\n            totalSize += fileSize.unsignedIntegerValue;\n            fileCount += 1;\n        }\n        \n        NSString *totalSizeStr = nil;\n        NSUInteger mb = 1024 *1024;\n        if (totalSize <mb) {\n            totalSizeStr = [NSString stringWithFormat:@\"%.4f KB\",(totalSize * 1.0/1024)];\n        }else{\n            totalSizeStr = [NSString stringWithFormat:@\"%.4f MB\",totalSize * 1.0/(mb)];\n        }\n        if (_isDebugMode) {\n            SJLog(@\"=========== Calculate cache size succeed:total fileCount:%ld & totalSize:%@\",(unsigned long)fileCount,totalSizeStr);\n        }\n        if (completionBlock) {\n            dispatch_async(dispatch_get_main_queue(), ^{                \n                completionBlock(fileCount, totalSize, totalSizeStr);\n            });\n        }\n    });\n\n}\n\n\n#pragma mark Clear Cache\n\n- (void)clearAllCacheCompletionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock{\n\n    dispatch_async(sj_cache_io_queue(), ^{\n        \n        NSError *removeCacheFolderError = nil;\n        NSError *createCacheFolderError = nil;\n        [_fileManager removeItemAtPath:_cacheBasePath error:&removeCacheFolderError];\n        \n        if (!removeCacheFolderError) {\n            \n            [_fileManager createDirectoryAtPath:_cacheBasePath\n                    withIntermediateDirectories:YES\n                                     attributes:nil\n                                          error:&createCacheFolderError];\n            \n            if (!createCacheFolderError) {\n                \n                dispatch_async(dispatch_get_main_queue(), ^{\n                SJLog(@\"=========== Clearing all cache successfully\");\n                if (completionBlock) {\n                        completionBlock(YES);\n                        return;\n                }\n                });\n            }else{\n                \n                dispatch_async(dispatch_get_main_queue(), ^{\n                if (_isDebugMode) {\n                    SJLog(@\"=========== Clearing cache error: Failed to create cache folder after removing it\");\n                }\n                if(completionBlock) {\n                    \n                        completionBlock(NO);\n                        return;\n                      }\n                });\n              \n            }\n        }else{\n            \n            dispatch_async(dispatch_get_main_queue(), ^{\n                if (_isDebugMode) {\n                    SJLog(@\"=========== Clearing cache error: Failed to remove cache folder\");\n                }\n                if (completionBlock) {\n                    completionBlock(NO);\n                    return;\n                }\n            });\n               \n        };\n    });\n}\n\n\n\n- (void)clearCacheWithUrl:(NSString * _Nonnull)url completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock{\n\n    \n    NSString *partiticalIdentifier = [SJNetworkUtils generatePartialIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                              requestUrlStr:url\n                                                                                  methodStr:nil];\n    \n    [self p_clearCacheWithIdentifier:partiticalIdentifier completionBlock:completionBlock];\n    \n}\n\n\n\n\n- (void)clearCacheWithUrl:(NSString * _Nonnull)url\n                   method:(NSString * _Nonnull)method\n          completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock{\n    \n    NSString *partiticalIdentifier = [SJNetworkUtils generatePartialIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                              requestUrlStr:url\n                                                                                  methodStr:method];\n    \n    [self p_clearCacheWithIdentifier:partiticalIdentifier completionBlock:completionBlock];\n}\n\n\n\n\n- (void)clearCacheWithUrl:(NSString * _Nonnull)url\n                   method:(NSString * _Nonnull)method\n               parameters:(id _Nullable)parameters\n          completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock{\n\n    NSString *requestIdentifer = [SJNetworkUtils generateRequestIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                          requestUrlStr:url\n                                                                              methodStr:method\n                                                                             parameters:parameters];\n    \n    [self p_clearCacheWithIdentifier:requestIdentifer completionBlock:completionBlock];\n    \n}\n\n\n\n#pragma mark Update resume data or resume data info\n\n- (void)updateResumeDataInfoAfterSuspendWithRequestModel:(SJNetworkRequestModel *_Nonnull)requestModel{\n    \n    NSData *resumeData = requestModel.task.error.userInfo[NSURLSessionDownloadTaskResumeData];\n    [resumeData writeToFile:requestModel.resumeDataFilePath options:NSDataWritingAtomic error:nil];\n    \n    int64_t downloadedByte = requestModel.task.countOfBytesReceived;\n    int64_t totalByte = requestModel.task.countOfBytesExpectedToReceive;\n    CGFloat percent = 1.0 *downloadedByte/totalByte;\n    SJNetworkDownloadResumeDataInfo *dataInfo = [self loadResumeDataInfo:requestModel.resumeDataInfoFilePath];\n    dataInfo.resumeDataLength = [NSString stringWithFormat:@\"%lld\",downloadedByte];\n    dataInfo.totalDataLength = [NSString stringWithFormat:@\"%lld\",totalByte];\n    dataInfo.resumeDataRatio = [NSString stringWithFormat:@\"%.2f\",percent];\n    [NSKeyedArchiver archiveRootObject:dataInfo toFile:requestModel.resumeDataInfoFilePath];\n}\n\n\n\n\n- (void)removeResumeDataAndResumeDataInfoFileWithRequestModel:(SJNetworkRequestModel *_Nonnull)requestModel{\n    \n    [_fileManager removeItemAtPath:requestModel.resumeDataFilePath error:nil];\n    [_fileManager removeItemAtPath:requestModel.resumeDataInfoFilePath error:nil];\n    \n}\n\n\n\n- (void)removeCompleteDownloadDataAndClearResumeDataInfoFileWithRequestModel:(SJNetworkRequestModel *_Nonnull)requestModel{\n    \n    NSError *moveFileError = nil;\n    [_fileManager moveItemAtPath:requestModel.resumeDataFilePath toPath:requestModel.downloadFilePath error:&moveFileError];\n    if (moveFileError.code == 516) {\n        [_fileManager removeItemAtPath:requestModel.resumeDataFilePath error:nil];\n    }\n    [_fileManager removeItemAtPath:requestModel.resumeDataInfoFilePath error:nil];\n    \n}\n\n\n\n- (void)removeCacheDataFile:(NSString *)cacheDataFilePath cacheInfoFile:(NSString *)cacheInfoFilePath{\n    \n    if([_fileManager fileExistsAtPath:cacheDataFilePath]){\n        [_fileManager removeItemAtPath:cacheDataFilePath error:nil];\n    }\n    \n    if([_fileManager fileExistsAtPath:cacheInfoFilePath]){\n        [_fileManager removeItemAtPath:cacheInfoFilePath error:nil];\n    }\n    \n}\n\n#pragma mark load resume data info\n\n\n- (SJNetworkDownloadResumeDataInfo *)loadResumeDataInfo:(NSString *)filePath {\n    \n    SJNetworkDownloadResumeDataInfo *dataInfo = nil;\n    if ([_fileManager fileExistsAtPath:filePath isDirectory:nil]) {\n        dataInfo = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath];\n        if ([dataInfo isKindOfClass:[SJNetworkDownloadResumeDataInfo class]]) {\n            return dataInfo;\n        }else{\n            return nil;\n        }\n    }\n    return nil;\n}\n\n\n\n\n\n#pragma mark- ============== Private Methods ==============\n\n\n- (void)p_wrtieCacheWithRequestModel:(SJNetworkRequestModel *)requestModel{\n    \n    if (requestModel.responseData) {\n        \n        //path of cache file\n        [requestModel.responseData writeToFile:requestModel.cacheDataFilePath atomically:YES];\n        \n        //write cache info data\n        SJNetworkCacheInfo *cacheInfo = [[SJNetworkCacheInfo alloc] init];\n        cacheInfo.creationDate = [NSDate date];\n        cacheInfo.cacheDuration = [NSNumber numberWithInteger:requestModel.cacheDuration];\n        cacheInfo.appVersionStr = [SJNetworkUtils appVersionStr];\n        cacheInfo.reqeustIdentifer = requestModel.requestIdentifer;\n        \n        //write cache info\n        [NSKeyedArchiver archiveRootObject:cacheInfo toFile:requestModel.cacheDataInfoFilePath];\n        \n        if (_isDebugMode) {\n            SJLog(@\"=========== Write cache succeed!\\n =========== cache object: %@\\n =========== Cache path: %@\\n =========== Available duration: %@ seconds\",requestModel.responseObject,requestModel.cacheDataFilePath,cacheInfo.cacheDuration);\n        }\n        \n    }else{\n        if (_isDebugMode) {\n            SJLog(@\"=========== Write cache failed! reason: There is no responeseData\");\n        }\n    }\n}\n\n- (void)p_loadCacheWithPartialIdentifier:(NSString *)partialIdentifier completionBlock:(SJLoadCacheArrCompletionBlock _Nullable)completionBlock{\n    \n    \n    NSDirectoryEnumerator *enumerator = [_fileManager enumeratorAtPath:_cacheBasePath];\n    NSMutableArray *requestIdentifersArr = [[NSMutableArray alloc] initWithCapacity:2];\n    \n    \n    for (NSString *fileName in enumerator){\n        \n        if ([fileName containsString:partialIdentifier]) {\n            \n            if ([fileName containsString:SJNetworkCacheFileSuffix]) {\n                \n                NSString *identifier = [fileName substringWithRange:NSMakeRange(0, (fileName.length - SJNetworkCacheFileSuffix.length - 1))];\n                [requestIdentifersArr addObject:identifier];\n                \n            }else{\n                //do not match cache data file\n            }\n        }\n    }\n    \n    if ([requestIdentifersArr count] > 0) {\n        NSMutableArray *cacheObjArr = [[NSMutableArray alloc] initWithCapacity:2];\n        \n        for (NSString* requestIdentifer in requestIdentifersArr) {\n            [self loadCacheWithRequestIdentifer:requestIdentifer completionBlock:^(id  _Nullable cacheObject) {\n                if (cacheObject) {\n                    [cacheObjArr addObject:cacheObject];\n                }\n            }];\n        }\n        \n        if (_isDebugMode) {\n            SJLog(@\"=========== Load cache succeed: Found cache corresponding this url\");\n        }\n        \n        dispatch_async(dispatch_get_main_queue(), ^{\n            if (completionBlock) {\n                completionBlock([cacheObjArr copy]);\n            }\n        });\n        \n        \n        \n    }else{\n        \n        if (_isDebugMode) {\n            SJLog(@\"=========== Load cache failed: There is no any cache corresponding this url\");\n        }\n        \n        dispatch_async(dispatch_get_main_queue(), ^{\n            if (completionBlock) {\n                completionBlock(nil);\n            }\n        });\n    }\n    \n}\n\n\n- (BOOL)p_checkCacheValidation:(SJNetworkCacheInfo *)cacheInfo{\n    \n    if (!cacheInfo || ![cacheInfo isKindOfClass:[SJNetworkCacheInfo class]]) {\n        return NO;\n    }\n    \n    //check duration\n    NSDate *creationDate = cacheInfo.creationDate;\n    NSTimeInterval pastDuration = - [creationDate timeIntervalSinceNow];\n    NSTimeInterval cacheDuration = [cacheInfo.cacheDuration integerValue];\n    \n    if (cacheDuration <= 0 ) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== Load cache info failed, reason: Did not set duration time, begin to clear cache...\");\n        }\n        [self p_clearCacheWithIdentifier:cacheInfo.reqeustIdentifer completionBlock:nil];\n        return NO;\n    }\n    \n    \n    if (pastDuration < 0 || pastDuration > cacheDuration) {\n        \n        if (_isDebugMode) {\n            SJLog(@\"=========== Load cache info failed, reason:Cache is expired, begin to clear cache...\");\n        }\n        \n        [self p_clearCacheWithIdentifier:cacheInfo.reqeustIdentifer completionBlock:nil];\n        return NO;\n    }\n    \n    \n    //check app version\n    NSString *cacheAppVersionStr = cacheInfo.appVersionStr;\n    NSString *currentAppVersionStr = [SJNetworkUtils appVersionStr];\n    \n    if ( (!cacheAppVersionStr) && (!currentAppVersionStr)) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== Load cache info failed, reason: Failed to load app version, begin to clear cache...\");\n        }\n        [self p_clearCacheWithIdentifier:cacheInfo.reqeustIdentifer completionBlock:nil];\n        return NO;\n    }\n    \n    if (cacheAppVersionStr.length != currentAppVersionStr.length || ![cacheAppVersionStr isEqualToString:currentAppVersionStr]) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== Load cache info failed, reason: Failed to match app version, begin to clear cache...\");\n        }\n        [self p_clearCacheWithIdentifier:cacheInfo.reqeustIdentifer completionBlock:nil];\n        return NO;\n    }\n    \n    return YES;\n    \n}\n\n\n\n- (void)p_clearCacheWithIdentifier:(NSString *)identifier completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock{\n    \n    \n    NSMutableArray *deleteFileNamesArr = [[NSMutableArray alloc] initWithCapacity:2];\n    NSDirectoryEnumerator *enumerator = [_fileManager enumeratorAtPath:_cacheBasePath];\n    \n    for (NSString *fileName in enumerator){\n        if ([fileName containsString:identifier]) {\n            NSString *deleteFilePath = [_cacheBasePath stringByAppendingPathComponent:fileName];\n            [deleteFileNamesArr addObject:deleteFilePath];\n        }\n    }\n    \n    if ([deleteFileNamesArr count] > 0) {\n        \n        for (NSInteger index = 0; index < deleteFileNamesArr.count; index++) {\n            \n            dispatch_async(sj_cache_io_queue(), ^{\n                \n                [_fileManager removeItemAtPath:deleteFileNamesArr[index] error:nil];\n                \n                if (index == deleteFileNamesArr.count - 1) {\n                    \n                    dispatch_async(dispatch_get_main_queue(), ^{\n                        if (_isDebugMode) {\n                            SJLog(@\"=========== Clearing cache successfully!\");\n                        }\n                        if (completionBlock) {\n                            completionBlock(YES);\n                            return;\n                        }\n                    });\n                }\n            });\n            \n        }\n        \n    }else{\n        \n        dispatch_async(dispatch_get_main_queue(), ^{\n            if (_isDebugMode) {\n                SJLog(@\"=========== Clearing cache error: there is no corresponding cache info\");\n            }\n            if (completionBlock) {\n                completionBlock(NO);\n                return;\n            }\n        });\n        \n    }\n    \n}\n\n\n\n- (id)p_loadCacheObjectWithCacheFilePath:(NSString *)cacheFilePath{\n    \n    id cacheObject = nil;\n    NSError *error = nil;\n    \n    if ([_fileManager fileExistsAtPath:cacheFilePath isDirectory:nil]) {\n        NSData *data = [NSData dataWithContentsOfFile:cacheFilePath];\n        cacheObject = [NSJSONSerialization JSONObjectWithData:data options:(NSJSONReadingOptions)0 error:&error];\n        if (cacheObject) {\n            return cacheObject;\n        }\n    }\n    return cacheObject;\n}\n\n\n\n- (SJNetworkCacheInfo *)p_loadCacheInfoWithRequestIdentifier:(NSString *)requestIdentifer {\n    \n    NSString *cacheInfoFilePath = [SJNetworkUtils cacheDataInfoFilePathWithRequestIdentifer:requestIdentifer];\n    \n    SJNetworkCacheInfo *cacheInfo = nil;\n    if ([_fileManager fileExistsAtPath:cacheInfoFilePath isDirectory:nil]) {\n        \n        cacheInfo = [NSKeyedUnarchiver unarchiveObjectWithFile:cacheInfoFilePath];\n        if ([cacheInfo isKindOfClass:[SJNetworkCacheInfo class]]) {\n            return cacheInfo;\n        }else{\n            return nil;\n        }\n    }\n    return nil;\n}\n\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkConfig.h",
    "content": "//\n//  SJNetworkConfig.h\n//  SJNetwork\n//\n//  Created by Sun Shijie on 2017/8/16.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n\n/* =============================\n *\n * SJNetworkConfig\n *\n * SJNetworkConfig is in charge of the configuration of all related network requests\n *\n * =============================\n */\n\n@interface SJNetworkConfig : NSObject\n\n// Base url of requests, default is nil\n@property (nonatomic, strong) NSString *_Nullable baseUrl;\n\n// Default parameters, default is nil\n@property (nonatomic, strong) NSDictionary * _Nullable defailtParameters;\n\n// Custom headers, default is nil\n@property (nonatomic, readonly, strong) NSDictionary * _Nullable customHeaders;\n\n// Request timeout seconds, default is 20 (unit is second)\n@property (nonatomic, assign) NSTimeInterval timeoutSeconds;\n\n// If debugMode is set to be YES, then print all detail log\n@property (nonatomic, assign) BOOL debugMode;\n\n\n\n/**\n *  SJNetworkConfig Singleton\n *\n *  @return sharedConfig singleton instance\n */\n+ (SJNetworkConfig *_Nullable)sharedConfig;\n\n\n\n/**\n *  This method is used to add request headers (key-value pair(or pairs))\n *\n *  @param header               custom header to be added into request\n *\n */\n- (void)addCustomHeader:(NSDictionary *_Nonnull)header;\n\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkConfig.m",
    "content": "//\n//  SJNetworkConfig.m\n//  SJNetwork\n//\n//  Created by Sun Shijie on 2017/8/16.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"SJNetworkConfig.h\"\n\n@interface SJNetworkConfig()\n\n@property (nonatomic, readwrite, strong) NSDictionary *customHeaders;\n\n@end\n\n@implementation SJNetworkConfig\n\n+ (SJNetworkConfig *)sharedConfig {\n    \n    static SJNetworkConfig *sharedInstance = nil;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        sharedInstance = [[self alloc] init];\n        sharedInstance.timeoutSeconds = 20;\n    });\n    return sharedInstance;\n}\n\n\n- (void)addCustomHeader:(NSDictionary *)header{\n    \n    if (![header isKindOfClass:[NSDictionary class]]) {\n        return;\n    }\n    \n    if ([[header allKeys] count] == 0) {\n        return;\n    }\n    \n    if (!_customHeaders) {\n         _customHeaders = header;\n        return;\n    }\n    \n    //add custom header\n    NSMutableDictionary *headers_m = [_customHeaders mutableCopy];\n    [header enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString *value, BOOL * _Nonnull stop) {\n        [headers_m setObject:value forKey:key];\n    }];\n    \n    _customHeaders = [headers_m copy];\n    \n}\n\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkDownloadEngine.h",
    "content": "//\n//  SJNetworkDownloadManager.h\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/25.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n#import \"SJNetworkBaseEngine.h\"\n\n\n/* =============================\n *\n * SJNetworkDownloadEngine\n *\n * SJNetworkDownloadEngine is in charge of sending downloading requests.\n *\n * =============================\n */\n\n@interface SJNetworkDownloadEngine : SJNetworkBaseEngine\n\n\n//========================= Request API upload images ==========================//\n\n\n\n/**\n *  This method offers the most number of parameters of a certain download request.\n \n *  @note:\n *        1. All the other download file API will call this method.\n *\n *        2. If 'ignoreBaseUrl' is set to be YES, the base url which is holden by\n *           SJNetworkConfig will be ignored, so the 'url' will be the complete request\n *           url of this request.(default is set to be YES)\n *\n *        3. If 'resumable' is set to be YES, incomplete download data will be saved and\n *           when the same request is sent, the saved data will be used.(default is set to be YES)\n *\n *  @param url                      request url\n *  @param ignoreBaseUrl            consider whether to ignore configured base url\n *  @param downloadFilePath         target path of download file\n *  @param resumable                consider whether to save or load resumble data\n *  @param downloadProgressBlock    download progress callback\n *  @param downloadSuccessBlock     download success callback\n *  @param downloadFailureBlock     download failure callback\n *\n */\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n              ignoreBaseUrl:(BOOL)ignoreBaseUrl\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                  resumable:(BOOL)resumable\n          backgroundSupport:(BOOL)backgroundSupport\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock;\n\n\n\n\n\n/**\n *  This method is used to suspend all current download requests\n */\n- (void)suspendAllDownloadRequests;\n\n\n\n\n/**\n *  This method is used to suspend a download request with given url\n *\n *  @param url                   download url\n *\n */\n- (void)suspendDownloadRequest:(NSString * _Nonnull)url;\n\n\n\n\n/**\n *  This method is used to suspend a download request with given url which contains the baseUrl or not\n *\n *  @param url                   download url\n *  @param ignoreBaseUrl         ignore baseUrl or not\n *\n */\n- (void)suspendDownloadRequest:(NSString * _Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n\n/**\n *  This method is used to suspend one nor more download requests with given urls array\n *\n *  @param urls                   download url array\n *\n */\n- (void)suspendDownloadRequests:(NSArray *_Nonnull)urls;\n\n\n\n\n/**\n *  This method is used to suspend one nor more download requests with given urls which contain the baseUrl or not\n *\n *  @param urls                   download url array\n *  @param ignoreBaseUrl          ignore baseUrl or not\n *\n */\n- (void)suspendDownloadRequests:(NSArray *_Nonnull)urls ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n\n\n/**\n *  This method is used to resume all suspended download requests\n */\n- (void)resumeAllDownloadRequests;\n\n\n\n\n\n/**\n *  This method is used to resume a suspended request with given url\n *\n *  @param url                   download url\n *\n */\n- (void)resumeDownloadReqeust:(NSString *_Nonnull)url;\n\n\n\n\n/**\n *  This method is used to resume a suspended request with given url which contains the baseUrl or not\n *\n *  @param url                   download url\n *  @param ignoreBaseUrl         ignore baseUrl or not\n *\n */\n- (void)resumeDownloadReqeust:(NSString *_Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n\n/**\n *  This method is used to resume one nor more suspended requests with given urls array\n *\n *  @param urls                   download url array\n *\n */\n- (void)resumeDownloadReqeusts:(NSArray *_Nonnull)urls;\n\n\n\n\n/**\n *  This method is used to suspend one nor more suspended requests with given urls which contain the baseUrl or not\n *\n *  @param urls                   download url array\n *  @param ignoreBaseUrl          ignore baseUrl or not\n *\n */\n- (void)resumeDownloadReqeusts:(NSArray *_Nonnull)urls ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n\n\n/**\n *  This method is used to cancel all current download requests\n */\n- (void)cancelAllDownloadRequests;\n\n\n\n\n\n/**\n *  This method is used to cancel a current download request with given url\n *\n *  @param url                   download url\n *\n */\n- (void)cancelDownloadRequest:(NSString * _Nonnull)url;\n\n\n\n\n\n/**\n *  This method is used to cancel a current download request with given url which contains the baseUrl or not\n *\n *  @param url                   download url\n *  @param ignoreBaseUrl         ignore baseUrl or not\n *\n */\n- (void)cancelDownloadRequest:(NSString * _Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n\n\n/**\n *  This method is used to cancel one nor more current download requests with given urls array\n *\n *  @param urls                   download url array\n *\n */\n- (void)cancelDownloadRequests:(NSArray *_Nonnull)urls;\n\n\n\n\n/**\n *  This method is used to cancel one nor more current download requests with given urls which contain the baseUrl or not\n *\n *  @param urls                   download url array\n *  @param ignoreBaseUrl          ignore baseUrl or not\n *\n */\n- (void)cancelDownloadRequests:(NSArray *_Nonnull)urls ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n\n\n\n/**\n *  This method is used to get incomplete download data ratio of a download request with a given download url\n *\n *  @param url                    download url\n *\n *  @return incomplete download data ratio\n */\n- (CGFloat)resumeDataRatioOfRequest:(NSString *_Nonnull)url;\n\n\n\n\n\n/**\n *  This method is used to get incomplete download data ratio of a download request with a given download url which contains the baseUrl or not\n *\n *  @param url                    download url\n *  @param ignoreBaseUrl          ignore baseUrl or not\n *\n *  @return incomplete download data ratio\n */\n- (CGFloat)resumeDataRatioOfRequest:(NSString *_Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkDownloadEngine.m",
    "content": "//\n//  SJNetworkDownloadManager.m\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/25.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"SJNetworkDownloadEngine.h\"\n#import \"SJNetworkDownloadResumeDataInfo.h\"\n#import \"SJNetworkCacheManager.h\"\n#import \"SJNetworkRequestPool.h\"\n#import \"SJNetworkConfig.h\"\n#import \"SJNetworkUtils.h\"\n#import \"SJNetworkProtocol.h\"\n\n\n@interface SJNetworkDownloadEngine()<NSURLSessionDelegate,NSURLSessionDownloadDelegate,SJNetworkProtocol>\n\n@property (nonatomic, strong) NSURLSession *downloadSession;\n@property (nonatomic, strong) NSURLSession *backgroundDownloadSession;\n\n@property (nonatomic, strong) SJNetworkCacheManager *cacheManager;\n\n@end\n\n\n@implementation SJNetworkDownloadEngine\n{\n    NSFileManager *_fileManager;\n    BOOL _isDebugMode;\n}\n\n#pragma mark- ============== Life Cycle Methods ==============\n\n\n- (instancetype)init{\n    \n    self = [super init];\n    if (self) {\n        \n        //file  manager\n        _fileManager = [NSFileManager defaultManager];\n        \n        //debug mode\n        _isDebugMode = [SJNetworkConfig sharedConfig].debugMode;\n        \n        //cache manager\n        _cacheManager = [SJNetworkCacheManager sharedManager];\n    }\n    \n    return self;\n}\n\n\n- (void)dealloc{\n\n    [_backgroundDownloadSession invalidateAndCancel];\n    [_backgroundDownloadSession resetWithCompletionHandler:^{\n        \n    }];\n    \n    [_downloadSession invalidateAndCancel];\n    [_downloadSession resetWithCompletionHandler:^{\n        \n    }];\n    \n}\n\n\n#pragma mark- ============== Setter and Getter ==============\n\n- (NSURLSession *)downloadSession\n{\n    static NSURLSession *downloadSession = nil;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        NSURLSessionConfiguration* sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration];\n        sessionConfig.timeoutIntervalForRequest = [SJNetworkConfig sharedConfig].timeoutSeconds;\n        downloadSession = [NSURLSession sessionWithConfiguration:sessionConfig\n                                                        delegate:self\n                                                   delegateQueue:[NSOperationQueue mainQueue]];\n      \n \n    });\n    return downloadSession;\n    \n}\n\n\n\n- (NSURLSession *)backgroundDownloadSession\n{\n    static NSURLSession *backgroundDownloadSession = nil;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        NSString *identifier = @\"SJNetworkBackgroundSession\";\n        NSURLSessionConfiguration* sessionConfig = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:identifier];\n        sessionConfig.timeoutIntervalForRequest = [SJNetworkConfig sharedConfig].timeoutSeconds;\n        backgroundDownloadSession = [NSURLSession sessionWithConfiguration:sessionConfig\n                                                                  delegate:self\n                                                             delegateQueue:[NSOperationQueue mainQueue]];\n    });\n    return backgroundDownloadSession;\n    \n}\n\n\n#pragma mark- ============== Public Methods ==============\n\n#pragma mark ============== Download API ==============\n\n\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n              ignoreBaseUrl:(BOOL)ignoreBaseUrl\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                  resumable:(BOOL)resumable\n          backgroundSupport:(BOOL)backgroundSupport\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock{\n    \n    \n    //complete request url\n    NSString *completeUrlStr = nil;\n    \n    // a unique identifer of a download request\n    NSString *requestIdentifer = nil;\n    \n    if (ignoreBaseUrl) {\n        \n        completeUrlStr   = url;\n        requestIdentifer = [SJNetworkUtils generateDownloadRequestIdentiferWithBaseUrlStr:nil\n                                                                            requestUrlStr:url];\n    }else{\n        \n        completeUrlStr   = [[SJNetworkConfig sharedConfig].baseUrl stringByAppendingPathComponent:url];\n        requestIdentifer = [SJNetworkUtils generateDownloadRequestIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                            requestUrlStr:url];\n    }\n    \n    //Check if a download task with same download url exists\n    __block BOOL sameUrlTaskExists = NO;\n    if ([[SJNetworkRequestPool sharedPool] remainingCurrentRequests]) {\n        [[SJNetworkRequestPool sharedPool].currentRequestModels enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, SJNetworkRequestModel * _Nonnull requestModel, BOOL * _Nonnull stop) {\n            if ([requestModel.requestUrl isEqualToString:completeUrlStr]) {\n                sameUrlTaskExists = YES;\n                SJLog(@\"=========== Download request can not be started, since there is a task with the same download url:%@\",completeUrlStr);\n                return;\n            }\n        }];\n    }\n    if (sameUrlTaskExists) {\n        return;\n    }\n    \n    NSString *downloadTargetFilePath = nil;\n    BOOL isDirectory;\n    if(![[NSFileManager defaultManager] fileExistsAtPath:downloadFilePath isDirectory:&isDirectory]) {\n        isDirectory = NO;\n    }\n    \n    // If given downloadFilePath is a directory, then append it with file name to get downloadTargetFilePath(download file path)\n    if (isDirectory) {\n        NSString *fileName = [completeUrlStr lastPathComponent];\n        downloadTargetFilePath = [NSString pathWithComponents:@[downloadFilePath, fileName]];\n    } else {\n        downloadTargetFilePath = downloadFilePath;\n    }\n    \n    \n    \n    //remove same file in target download path\n    if ([_fileManager fileExistsAtPath:downloadTargetFilePath]) {\n        [_fileManager removeItemAtPath:downloadTargetFilePath error:nil];\n    }\n    \n    \n    \n    \n    //default method is GET\n    NSString *methodStr = @\"GET\";\n    \n    //create corresponding request model and send request with it\n    SJNetworkRequestModel *requestModel = [[SJNetworkRequestModel alloc] init];\n    requestModel.requestUrl = completeUrlStr;\n    requestModel.method = methodStr;\n    requestModel.requestIdentifer = requestIdentifer;\n    requestModel.downloadFilePath = downloadTargetFilePath;\n    requestModel.resumableDownload = resumable;\n    requestModel.backgroundDownloadSupport = backgroundSupport;\n    requestModel.manualOperation = SJDownloadManualOperationStart;\n    requestModel.downloadSuccessBlock = downloadSuccessBlock;\n    requestModel.downloadProgressBlock = downloadProgressBlock;\n    requestModel.downloadFailureBlock = downloadFailureBlock;\n    \n    NSURLSessionTask *downloadTask = nil;\n    \n    if (requestModel.backgroundDownloadSupport) {\n        \n        //downloadTask class : NSURLSessionDownloadTask\n        downloadTask = [self p_backgroundDownloadTaskWithRequestModel:requestModel];\n        \n    }else{\n        \n        //downloadTask class : NSURLSessionDataTask\n        downloadTask = [self p_noneBackgroundDownloadTaskWithRequestModel:requestModel];\n    }\n    \n    //keep task in request model\n    requestModel.task = downloadTask;\n    \n    //move this request model into requests set\n    [[SJNetworkRequestPool sharedPool] addRequestModel:requestModel];\n    \n    SJLog(@\"=========== start downloading:\\n =========== url:%@\\n =========== downloadPath:%@\",completeUrlStr,requestModel.downloadFilePath);\n    \n    \n    //start request\n    [downloadTask resume];\n    \n    \n}\n\n#pragma mark ============== Suspend API ==============\n\n\n- (void)suspendAllDownloadRequests{\n    \n    if(![[SJNetworkRequestPool sharedPool] remainingCurrentRequests]){\n        return;\n    }\n    \n    __block BOOL hasDownloadRequests = NO;\n    [[SJNetworkRequestPool sharedPool].currentRequestModels enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, SJNetworkRequestModel * _Nonnull requestModel, BOOL * _Nonnull stop) {\n        \n        if (requestModel.requestType == SJRequestTypeDownload) {\n            hasDownloadRequests = YES;\n            \n            if (requestModel.task) {\n                \n                if (requestModel.task.state == NSURLSessionTaskStateRunning) {\n                    \n                    if (requestModel.backgroundDownloadSupport) {\n                        \n                        requestModel.manualOperation = SJDownloadManualOperationSuspend;\n                        NSURLSessionDownloadTask *downloadTask = (NSURLSessionDownloadTask*)requestModel.task;\n                        [downloadTask cancelByProducingResumeData:^(NSData * _Nullable resumeData) {\n                        }];\n                        \n                    }else{\n                        \n                        [requestModel.task suspend];\n                        [_cacheManager updateResumeDataInfoAfterSuspendWithRequestModel:requestModel];\n                        SJLog(@\"=========== Suspended request:%@\",requestModel);\n                        \n                    }\n                    \n                    \n                }else {\n                    SJLog(@\"=========== Request %@ can not be suspended,since it is not running\",requestModel);\n                }\n                \n            }else {\n                SJLog(@\"=========== There is no donwload task of this request\");\n            }\n        }\n    }];\n    \n    if (!hasDownloadRequests) {\n        SJLog(@\"=========== There is no donwload task to suspend\");\n    }\n}\n\n\n\n- (void)suspendDownloadRequest:(NSString * _Nonnull)url;{\n    \n    if (url.length == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== The input url is an empty string!\");\n        }\n        return;\n    }\n    \n    if(![[SJNetworkRequestPool sharedPool] remainingCurrentRequests]){\n        return;\n    }\n    \n    //a unique identifer of a download request\n    NSString *downloadRequestIdentifier =  [SJNetworkUtils generateDownloadRequestIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                                            requestUrlStr:url];\n    [self p_suspendDownloadRequestWithDownloadRequestIdentifier:downloadRequestIdentifier];\n    \n}\n\n\n- (void)suspendDownloadRequest:(NSString * _Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n    \n    if (url.length == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== The input url is an empty string!\");\n        }\n        return;\n    }\n    \n    if(![[SJNetworkRequestPool sharedPool] remainingCurrentRequests]){\n        return;\n    }\n    \n    NSString *baseUrl = nil;\n    \n    if (!ignoreBaseUrl) {\n        baseUrl = [SJNetworkConfig sharedConfig].baseUrl;\n    }\n    \n    [self p_suspendDownloadRequestWithDownloadRequestIdentifier:[SJNetworkUtils generateDownloadRequestIdentiferWithBaseUrlStr:baseUrl requestUrlStr:url]];\n    \n}\n\n\n- (void)suspendDownloadRequests:(NSArray * _Nonnull)urls{\n    \n    \n    if ([urls count] == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== There is no input donwload urls!\");\n        }\n        return;\n    }\n    \n    if(![[SJNetworkRequestPool sharedPool] remainingCurrentRequests]){\n        return;\n    }\n    \n    [urls enumerateObjectsUsingBlock:^(NSString * url, NSUInteger idx, BOOL * _Nonnull stop) {\n        [self suspendDownloadRequest:url];\n    }];\n}\n\n\n- (void)suspendDownloadRequests:(NSArray *_Nonnull)urls ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n    if ([urls count] == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== There is no input donwload urls!\");\n        }\n        return;\n    }\n    \n    if(![[SJNetworkRequestPool sharedPool] remainingCurrentRequests]){\n        return;\n    }\n    \n    [urls enumerateObjectsUsingBlock:^(NSString * url, NSUInteger idx, BOOL * _Nonnull stop) {\n        [self suspendDownloadRequest:url ignoreBaseUrl:ignoreBaseUrl];\n    }];\n    \n}\n\n\n#pragma mark ============== Resume API ==============\n\n\n- (void)resumeAllDownloadRequests{\n    \n    __block BOOL hasDownloadRequests = NO;\n    \n    [[SJNetworkRequestPool sharedPool].currentRequestModels enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, SJNetworkRequestModel * _Nonnull requestModel, BOOL * _Nonnull stop) {\n        \n        \n        if (requestModel.requestType == SJRequestTypeDownload) {\n            \n            hasDownloadRequests = YES;\n            \n            if (requestModel.task) {\n                \n                if(requestModel.backgroundDownloadSupport){\n                    \n                    NSString *resumeDataFilePath = requestModel.resumeDataFilePath;\n                    \n                    if ([_fileManager fileExistsAtPath:resumeDataFilePath]) {\n                        NSData *resumeData = [NSData dataWithContentsOfFile:resumeDataFilePath];\n                        if (resumeData) {\n                            NSString *oldTaskKey = [NSString stringWithFormat:@\"%ld\",(unsigned long)requestModel.task.taskIdentifier];\n                            NSURLSessionTask * downloadTask = [self.backgroundDownloadSession downloadTaskWithResumeData:resumeData];\n                            requestModel.task = downloadTask;\n                            //change request model\n                            [[SJNetworkRequestPool sharedPool] changeRequestModel:requestModel forKey:oldTaskKey];\n                            [downloadTask resume];\n                            SJLog(@\"=========== Resumed background support download request: %@\",requestModel);\n                        }else{\n                            SJLog(@\"=========== Can not resume background support download request: %@, since resume data is not available\",requestModel);\n                        }\n                    }else{\n                        SJLog(@\"=========== Can not resume background support download request: %@, since there is no resume data in path %@\",requestModel,resumeDataFilePath);\n                    }\n                    \n                    \n                }else{\n                    if (requestModel.task.state == NSURLSessionTaskStateSuspended) {\n                        [requestModel.task resume];\n                        SJLog(@\"=========== Resumed request: %@\",requestModel);\n                    }else{\n                        SJLog(@\"=========== Can not resume request: %@, since it is not suspended\",requestModel);\n                    }\n                }\n                \n            }else {\n                SJLog(@\"=========== There is no download task of this request\");\n            }\n        }\n    }];\n    \n    if (!hasDownloadRequests) {\n        SJLog(@\"=========== There is no donwload task to resume\");\n    }\n    \n}\n\n- (void)resumeDownloadReqeust:(NSString *_Nonnull)url{\n    \n    \n    if (url.length == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== The input url is an empty string!\");\n        }\n        return;\n    }\n    \n    if(![[SJNetworkRequestPool sharedPool] remainingCurrentRequests]){\n        return;\n    }\n    \n    //a unique identifer of a download request\n    NSString *downloadRequestIdentifier =  [SJNetworkUtils generateDownloadRequestIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                                            requestUrlStr:url];\n    [self p_resumeDownloadRequestWithDownloadRequestIdentifier:downloadRequestIdentifier];\n    \n    \n}\n\n- (void)resumeDownloadReqeust:(NSString *_Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n    if (url.length == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== The input url is an empty string!\");\n        }\n        return;\n    }\n    if(![[SJNetworkRequestPool sharedPool] remainingCurrentRequests]){\n        return;\n    }\n    \n    NSString *baseUrl = nil;\n    \n    if (!ignoreBaseUrl) {\n        baseUrl = [SJNetworkConfig sharedConfig].baseUrl;\n    }\n    \n    //a unique identifer of a download request\n    NSString *downloadRequestIdentifier =  [SJNetworkUtils generateDownloadRequestIdentiferWithBaseUrlStr:baseUrl\n                                                                                            requestUrlStr:url];\n    [self p_resumeDownloadRequestWithDownloadRequestIdentifier:downloadRequestIdentifier];\n}\n\n\n- (void)resumeDownloadReqeusts:(NSArray *_Nonnull)urls{\n    \n    if ([urls count] == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== There is no input donwload urls!\");\n        }\n        return;\n    }\n    \n    if(![[SJNetworkRequestPool sharedPool] remainingCurrentRequests]){\n        return;\n    }\n    \n    [urls enumerateObjectsUsingBlock:^(NSString * url, NSUInteger idx, BOOL * _Nonnull stop) {\n        [self resumeDownloadReqeust:url];\n    }];\n    \n}\n\n- (void)resumeDownloadReqeusts:(NSArray *_Nonnull)urls ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n    if ([urls count] == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== There is no input donwload urls!\");\n        }\n        return;\n    }\n    \n    [urls enumerateObjectsUsingBlock:^(NSString * url, NSUInteger idx, BOOL * _Nonnull stop) {\n        [self resumeDownloadReqeust:url ignoreBaseUrl:ignoreBaseUrl];\n    }];\n    \n}\n\n\n\n\n#pragma mark ============== Cancel API ==============\n\n\n- (void)cancelAllDownloadRequests{\n    \n    if(![[SJNetworkRequestPool sharedPool] remainingCurrentRequests]){\n        return;\n    }\n    \n    __block BOOL hasDownloadRequests = NO;\n    [[SJNetworkRequestPool sharedPool].currentRequestModels enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, SJNetworkRequestModel * _Nonnull requestModel, BOOL * _Nonnull stop) {\n        \n        if (requestModel.requestType == SJRequestTypeDownload) {\n            \n            hasDownloadRequests = YES;\n            if (requestModel.task) {\n                \n                if (requestModel.backgroundDownloadSupport) {\n                    \n                    NSURLSessionDownloadTask *downloadTask = (NSURLSessionDownloadTask*)requestModel.task;\n                    requestModel.manualOperation = SJDownloadManualOperationCancel;\n                    [downloadTask cancelByProducingResumeData:^(NSData * _Nullable resumeData) {\n                    }];\n                    \n                }else{\n                    [requestModel.task cancel];\n                }\n                SJLog(@\"=========== Canceled request:%@\",requestModel);\n            }else {\n                SJLog(@\"=========== There is no donwload task of this request\");\n            }\n        }\n    }];\n    \n    if (!hasDownloadRequests) {\n        SJLog(@\"=========== There is no donwload task to cancel\");\n    }\n}\n\n\n\n\n- (void)cancelDownloadRequest:(NSString * _Nonnull)url{\n    \n    if (url.length == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== The input url is an empty string!\");\n        }\n        return;\n    }\n    \n    [[SJNetworkRequestPool sharedPool] cancelCurrentRequestWithUrl:url];\n}\n\n\n- (void)cancelDownloadRequest:(NSString * _Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n    if (url.length == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== The input url is an empty string!\");\n        }\n         return;\n    }\n    \n    \n    NSString *requestUrl = nil;\n    if (!ignoreBaseUrl) {\n        requestUrl = [[SJNetworkConfig sharedConfig].baseUrl stringByAppendingPathComponent:url];\n    }else{\n        requestUrl = url;\n    }\n    \n    [[SJNetworkRequestPool sharedPool] cancelCurrentRequestWithUrl:requestUrl];\n    \n    \n}\n\n\n- (void)cancelDownloadRequests:(NSArray *_Nonnull)urls{\n    \n    if ([urls count] == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== The input url array is empty!\");\n        }\n         return;\n    }\n    \n    [urls enumerateObjectsUsingBlock:^(NSString *url, NSUInteger idx, BOOL * _Nonnull stop) {\n        [[SJNetworkRequestPool sharedPool] cancelCurrentRequestWithUrl:url];\n    }];\n    \n}\n\n\n\n\n- (void)cancelDownloadRequests:(NSArray *_Nonnull)urls ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n    if ([urls count] == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== The input url array is empty!\");\n        }\n        return;\n    }\n    \n    [urls enumerateObjectsUsingBlock:^(NSString *url, NSUInteger idx, BOOL * _Nonnull stop) {\n        \n        NSString *requestUrl = nil;\n        if (!ignoreBaseUrl) {\n            requestUrl = [[SJNetworkConfig sharedConfig].baseUrl stringByAppendingPathComponent:url];\n        }else{\n            requestUrl = url;\n        }\n        [[SJNetworkRequestPool sharedPool] cancelCurrentRequestWithUrl:requestUrl];\n    }];\n}\n\n\n\n\n\n\n- (CGFloat)resumeDataRatioOfRequest:(NSString *_Nonnull)url{\n    \n    if (url.length == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== The input url is an empty string!\");\n        }\n        return 0.0;\n    }\n    \n    //a unique identifer of a download request\n    NSString *downloadRequestIdentifier =  [SJNetworkUtils generateDownloadRequestIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                                            requestUrlStr:url];\n    \n    return [self p_resumeDataRatioWithRequestIdentifier:downloadRequestIdentifier];\n    \n}\n\n\n\n\n- (CGFloat)resumeDataRatioOfRequest:(NSString *_Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n    if (url.length == 0) {\n        if (_isDebugMode) {\n            SJLog(@\"=========== The input url is an empty string!\");\n        }\n        return 0.0;\n    }\n    \n    NSString *baseUrl = nil;\n    \n    if (!ignoreBaseUrl) {\n        baseUrl = [SJNetworkConfig sharedConfig].baseUrl;\n    }\n    \n    //a unique identifer of a download request\n    NSString *downloadRequestIdentifier =  [SJNetworkUtils generateDownloadRequestIdentiferWithBaseUrlStr:baseUrl requestUrlStr:url];\n    \n    return [self p_resumeDataRatioWithRequestIdentifier:downloadRequestIdentifier];\n    \n}\n\n\n#pragma mark- ============== Private Methods ==============\n\n\n- (NSURLSessionTask *)p_backgroundDownloadTaskWithRequestModel:(SJNetworkRequestModel *)requestModel{\n    \n    \n    //init download request with request url\n    NSMutableURLRequest *downloadRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:requestModel.requestUrl]];\n    \n    //add custom header\n    [self p_addRequestHeaderInRequest:downloadRequest];\n   \n    \n    //temp download file\n    NSString *resumeDataFilePath = requestModel.resumeDataFilePath;\n    \n    NSString *resumeDataInfoFilePath = requestModel.resumeDataInfoFilePath;\n    \n    \n    if (![_fileManager fileExistsAtPath:resumeDataInfoFilePath]) {\n        SJNetworkDownloadResumeDataInfo  *dataInfo = [[SJNetworkDownloadResumeDataInfo alloc] init];\n        [NSKeyedArchiver archiveRootObject:dataInfo toFile:resumeDataInfoFilePath];\n    }\n    \n    NSURLSessionDownloadTask *downloadTask = nil;\n    \n    \n    if ([_fileManager fileExistsAtPath:resumeDataFilePath]) {\n        \n        \n        NSData *resumeData = [NSData dataWithContentsOfFile:resumeDataFilePath];\n        \n        if (resumeData) {\n            \n            if (requestModel.resumableDownload) {\n                downloadTask = [self.backgroundDownloadSession downloadTaskWithResumeData:resumeData];\n                \n            }else{\n                [_fileManager removeItemAtPath:resumeDataFilePath error:nil];\n                downloadTask = [self.backgroundDownloadSession downloadTaskWithRequest:downloadRequest];\n            }\n            \n        }else{\n            \n            [_fileManager removeItemAtPath:resumeDataFilePath error:nil];\n            downloadTask = [self.backgroundDownloadSession downloadTaskWithRequest:downloadRequest];\n        }\n        \n    }else{\n        \n        downloadTask = [self.backgroundDownloadSession downloadTaskWithRequest:downloadRequest];\n    }\n    \n    \n    \n    return downloadTask;\n}\n\n\n\n- (NSURLSessionTask *)p_noneBackgroundDownloadTaskWithRequestModel:(SJNetworkRequestModel *)requestModel{\n    \n    //init download request with request url\n    NSMutableURLRequest *downloadRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:requestModel.requestUrl]];\n    \n    //add custom header\n    [self p_addRequestHeaderInRequest:downloadRequest];\n    \n    \n    //temp download file\n    NSString *resumDataFilePath = requestModel.resumeDataFilePath;\n    \n    NSString *resumeDataInfoFilePath = requestModel.resumeDataInfoFilePath;\n    \n    \n    //create steam\n    NSOutputStream *stream = [NSOutputStream outputStreamToFileAtPath:resumDataFilePath append:YES];\n    requestModel.stream = stream;\n    \n    if (requestModel.resumableDownload) {\n        \n        if ([_fileManager fileExistsAtPath:resumeDataInfoFilePath] ) {\n            \n            //load resume data info\n            SJNetworkDownloadResumeDataInfo *dataInfo = [_cacheManager loadResumeDataInfo:resumeDataInfoFilePath];\n            \n            //check if resume data info exsists\n            if (dataInfo) {\n                \n                NSInteger resumeDataLength = [dataInfo.resumeDataLength integerValue];\n                if (resumeDataLength > 0) {\n                    NSString *range = [NSString stringWithFormat:@\"bytes=%zd-\", resumeDataLength];\n                    [downloadRequest setValue:range forHTTPHeaderField:@\"Range\"];\n                }\n                \n            }else{\n                \n                //if resume data info was not available and the corresponding data exists, then delete the corresponding data\n                if ([_fileManager fileExistsAtPath:resumDataFilePath]) {\n                    [_fileManager removeItemAtPath:resumeDataInfoFilePath error:nil];\n                }\n                \n            }\n        }else {\n            \n            //if this is a not a resumable download request and there is no resume data info, then create one\n            SJNetworkDownloadResumeDataInfo  *dataInfo = [[SJNetworkDownloadResumeDataInfo alloc] init];\n            [NSKeyedArchiver archiveRootObject:dataInfo toFile:resumeDataInfoFilePath];\n            \n            \n        }\n    }\n    \n    NSURLSessionDataTask *downloadTask = [self.downloadSession dataTaskWithRequest:downloadRequest];\n    return downloadTask;\n    \n}\n\n\n- (void)p_addRequestHeaderInRequest:(NSMutableURLRequest *)request{\n    \n    NSDictionary *customHeaders = [SJNetworkConfig sharedConfig].customHeaders;\n    if ([customHeaders allKeys] > 0) {\n        NSArray *allKeys = [customHeaders allKeys];\n        if ([allKeys count] >0) {\n            [customHeaders enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString *value, BOOL * _Nonnull stop) {\n                [request setValue:value forHTTPHeaderField:key];\n                if (_isDebugMode) {\n                    SJLog(@\"=========== added header:key:%@ value:%@\",key,value);\n                }\n            }];\n        }\n    }\n}\n\n\n- (void)p_suspendDownloadRequestWithDownloadRequestIdentifier:(NSString *)downloadRequestIdentifier{\n    \n    [[SJNetworkRequestPool sharedPool].currentRequestModels enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, SJNetworkRequestModel * _Nonnull requestModel, BOOL * _Nonnull stop) {\n        \n        if ([requestModel.requestIdentifer isEqualToString:downloadRequestIdentifier]) {\n            \n            if (requestModel.task) {\n                \n                if (requestModel.task.state == NSURLSessionTaskStateRunning) {\n                    \n                    if (requestModel.backgroundDownloadSupport) {\n                        \n                        requestModel.manualOperation = SJDownloadManualOperationSuspend;\n                        NSURLSessionDownloadTask *downloadTask = (NSURLSessionDownloadTask*)requestModel.task;\n                        [downloadTask cancelByProducingResumeData:^(NSData * _Nullable resumeData) {\n                        }];\n                        \n                    }else{\n                        \n                        [requestModel.task suspend];\n                        [_cacheManager updateResumeDataInfoAfterSuspendWithRequestModel:requestModel];\n                        SJLog(@\"=========== Suspended request:%@\",requestModel);\n                        \n                    }\n                    \n                }else {\n                    SJLog(@\"=========== Request %@ can not be suspended,since it is not running\",requestModel);\n                }\n                \n            }else {\n                SJLog(@\"=========== There is no donwload task of this request\");\n            }\n        }\n    }];\n    \n}\n\n- (void)p_resumeDownloadRequestWithDownloadRequestIdentifier:(NSString *)downloadRequestIdentifier{\n    \n    [[SJNetworkRequestPool sharedPool].currentRequestModels enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, SJNetworkRequestModel * _Nonnull requestModel, BOOL * _Nonnull stop) {\n        \n        if ([requestModel.requestIdentifer isEqualToString:downloadRequestIdentifier]) {\n            \n            if (requestModel.task) {\n                \n                if (requestModel.backgroundDownloadSupport) {\n                    \n                    if (requestModel.manualOperation == SJDownloadManualOperationSuspend) {\n                        \n                        NSString *resumeDataFilePath = requestModel.resumeDataFilePath;\n                        \n                        if ([_fileManager fileExistsAtPath:resumeDataFilePath]) {\n                            \n                            NSData *resumeData = [NSData dataWithContentsOfFile:resumeDataFilePath];\n                            if (resumeData) {\n                                \n                                NSString *oldTaskKey = [NSString stringWithFormat:@\"%ld\",(unsigned long)requestModel.task.taskIdentifier];\n                                NSURLSessionTask * downloadTask = [self.backgroundDownloadSession downloadTaskWithResumeData:resumeData];\n                                requestModel.manualOperation = SJDownloadManualOperationResume;\n                                requestModel.task = downloadTask;\n                                [[SJNetworkRequestPool sharedPool] changeRequestModel:requestModel forKey:oldTaskKey];\n                                [downloadTask resume];\n                                SJLog(@\"=========== Resumed background support download request: %@\",requestModel);\n                                \n                            }else{\n                                \n                                SJLog(@\"=========== Can not resume background support download request: %@, since resume data is not available\",requestModel);\n                                \n                            }\n                            \n                        }else{\n                            \n                            SJLog(@\"=========== Can not resume background support download request: %@, since there is no resume data in path %@\",requestModel,resumeDataFilePath);\n                        }\n                        \n                        \n                    }else{\n                        \n                        SJLog(@\"=========== Can not resume background support download request: %@, since it is not suspended(canceled) by user\",requestModel);\n                    }\n                    \n                }else{\n                    \n                    if (requestModel.task.state == NSURLSessionTaskStateSuspended) {\n                        [requestModel.task resume];\n                        SJLog(@\"=========== Resumed request: %@\",requestModel);\n                        \n                    }else{\n                        \n                        SJLog(@\"=========== Can not resume request: %@, since it is not suspended\",requestModel);\n                    }\n                }\n                \n            }else {\n                SJLog(@\"=========== There is no download task of this request\");\n            }\n        }\n    }];\n    \n}\n\n- (CGFloat)p_resumeDataRatioWithRequestIdentifier:(NSString *)requestIdentifier{\n    \n    NSString *resumeDataInfoFilePath = [SJNetworkUtils resumeDataInfoFilePathWithRequestIdentifer:requestIdentifier];\n    SJNetworkDownloadResumeDataInfo *dataInfo = [_cacheManager loadResumeDataInfo:resumeDataInfoFilePath];\n    \n    if (dataInfo) {\n        return [dataInfo.resumeDataRatio floatValue];\n    }else{\n        return 0.00;\n    }\n}\n\n\n#pragma mark- ============== SJNetworkProtocol ==============\n\n- (void)handleRequesFinished:(SJNetworkRequestModel *)requestModel{\n    \n    //clear all blocks\n    [requestModel clearAllBlocks];\n    \n    //remove this requst model from request queue\n    [[SJNetworkRequestPool sharedPool] removeRequestModel:requestModel];\n    \n}\n\n\n#pragma mark - ============== NSURLSessionTaskDelegate ==============\n\n- (void)URLSession:(NSURLSession *)session\n              task:(NSURLSessionTask *)task\ndidCompleteWithError:(NSError *)error{\n\n    if (_isDebugMode) {\n        SJLog(@\"=========== Download request did complete of task:%@\",task);\n    }\n\n    SJNetworkRequestModel * requestModel = [[SJNetworkRequestPool sharedPool].currentRequestModels objectForKey:[NSString stringWithFormat:@\"%ld\",(unsigned long)task.taskIdentifier]];\n\n    if (requestModel) {\n        \n        if (requestModel.backgroundDownloadSupport) {\n            \n            if (error) {\n                \n                //cancel request\n                if (error.code == -999) {\n                    \n                    [requestModel.task suspend];\n                    \n                    NSData *resumeData = requestModel.task.error.userInfo[NSURLSessionDownloadTaskResumeData];\n                    NSError *moveDownloadFileError = nil;\n                    \n                    if (requestModel.resumableDownload) {\n                        \n                        [resumeData writeToFile:requestModel.resumeDataFilePath options:NSDataWritingAtomic error:&moveDownloadFileError];\n                        \n                    }else{\n                        \n                        if (requestModel.manualOperation == SJDownloadManualOperationSuspend){\n                            \n                             [resumeData writeToFile:requestModel.resumeDataFilePath options:NSDataWritingAtomic error:&moveDownloadFileError];\n                            \n                        }else{\n                            \n                            if (_isDebugMode) {\n                                SJLog(@\"=========== Because this is not resumable downloading:\\n remove resume data in path:%@ \\n and resume data info in path:%@\",requestModel.resumeDataFilePath,requestModel.resumeDataInfoFilePath);\n                            }\n                            \n                            [_cacheManager removeResumeDataAndResumeDataInfoFileWithRequestModel:requestModel];\n                            \n                        }\n                        \n                       \n                        \n                    }\n                    \n                    if (requestModel.manualOperation == SJDownloadManualOperationSuspend) {\n                        \n                        SJLog(@\"=========== Suspended background support download request:%@\",requestModel);\n                        \n                    }else{\n                        \n                        SJLog(@\"=========== Canceled background support download request:%@\",requestModel);\n                        dispatch_async(dispatch_get_main_queue(), ^{\n                            if (requestModel.downloadFailureBlock) {\n                                    requestModel.downloadFailureBlock(requestModel.task, error,requestModel.resumeDataFilePath);\n                                \n                            }\n                            [self handleRequesFinished:requestModel];\n                       });\n                        \n                    }\n                    \n                    \n                }else{\n                    \n                    \n                    \n                    SJLog(@\"=========== Background support download failed, download file path:%@\",requestModel.downloadFilePath);\n                    \n                    dispatch_async(dispatch_get_main_queue(), ^{\n                        \n                        if (requestModel.downloadFailureBlock) {\n                                requestModel.downloadFailureBlock(requestModel.task, error,requestModel.resumeDataFilePath);\n                        }                        \n                        [self handleRequesFinished:requestModel];\n                    });\n                }\n                \n                \n            }else{\n                \n                \n                SJLog(@\"=========== Download succeed,download file path:%@\",requestModel.downloadFilePath);\n                 dispatch_async(dispatch_get_main_queue(), ^{\\\n                     \n                    if (requestModel.downloadSuccessBlock) {\n                        requestModel.downloadSuccessBlock(requestModel.downloadFilePath);\n                    }\n                    [self handleRequesFinished:requestModel];\n                     \n                });\n            }\n            \n            \n        }else {\n            \n            \n            if (error) {\n                \n                if (error.code == -997) {\n                    \n                    // The eror code equals to -997 means this app enters into background and then lost connect.\n                    // We offer an 'auto start request mechanism' to cope with this situation\n                   \n                    SJNetworkDownloadResumeDataInfo *dataInfo = [_cacheManager loadResumeDataInfo:requestModel.resumeDataInfoFilePath];\n                    NSDictionary *attributeDict = [_fileManager attributesOfItemAtPath:requestModel.resumeDataFilePath error:nil];\n                    NSInteger resumeDataLength = [attributeDict[NSFileSize] integerValue];\n                    dataInfo.resumeDataLength = [NSString stringWithFormat:@\"%ld\",(long)resumeDataLength];\n                    \n                    //ratio\n                    CGFloat ratio = 1.0 * ([dataInfo.resumeDataLength integerValue])/([dataInfo.totalDataLength integerValue]);\n                    dataInfo.resumeDataRatio = [NSString stringWithFormat:@\"%.2f\",ratio];\n                    [NSKeyedArchiver archiveRootObject:dataInfo toFile:requestModel.resumeDataInfoFilePath];\n                    \n                    \n                    [requestModel.stream close];\n                     requestModel.stream = nil;\n                    \n                    //lost connection background and the task is canceled\n                    NSString *oldTaskKey = [NSString stringWithFormat:@\"%ld\",(unsigned long)requestModel.task.taskIdentifier];\n                    //init download request with request url\n                    NSURLSessionTask * downloadTask = [self p_noneBackgroundDownloadTaskWithRequestModel:requestModel];\n                    requestModel.task = downloadTask;\n                    //change request model\n                    [[SJNetworkRequestPool sharedPool] changeRequestModel:requestModel forKey:oldTaskKey];\n                    [requestModel.task resume];\n                    \n                    \n                    \n                }else{\n                    \n                    if (requestModel.resumableDownload) {\n                        \n                        SJNetworkDownloadResumeDataInfo *dataInfo = [_cacheManager loadResumeDataInfo:requestModel.resumeDataInfoFilePath];\n                        NSDictionary *attributeDict = [_fileManager attributesOfItemAtPath:requestModel.resumeDataFilePath error:nil];\n                        NSInteger resumeDataLength = [attributeDict[NSFileSize] integerValue];\n                        dataInfo.resumeDataLength = [NSString stringWithFormat:@\"%ld\",(long)resumeDataLength];\n\n                        //ratio\n                        CGFloat ratio = 1.0 * ([dataInfo.resumeDataLength integerValue])/([dataInfo.totalDataLength integerValue]);\n                        dataInfo.resumeDataRatio = [NSString stringWithFormat:@\"%.2f\",ratio];\n                        [NSKeyedArchiver archiveRootObject:dataInfo toFile:requestModel.resumeDataInfoFilePath];\n                        \n                        \n                        if (_isDebugMode) {\n                            SJLog(@\"=========== Keep resume data in path:%@ \\n and save resume data info in path:%@, since this is a resumable donwloading\",requestModel.resumeDataFilePath,requestModel.resumeDataInfoFilePath);\n                        }\n                        \n                    }else {\n                        \n                        if (_isDebugMode) {\n                            SJLog(@\"=========== Remove resume data in path:%@ \\n and resume data info in path:%@, since this is not a resumable donwloading\",requestModel.resumeDataFilePath,requestModel.resumeDataInfoFilePath);\n                        }\n                        \n                        [_cacheManager removeResumeDataAndResumeDataInfoFileWithRequestModel:requestModel];\n                        \n                    }\n                    \n                    \n                    [requestModel.stream close];\n                     requestModel.stream = nil;\n                    \n                    \n                    SJLog(@\"=========== Download failed,download file path:%@\",requestModel.downloadFilePath);\n                    dispatch_async(dispatch_get_main_queue(), ^{\n                        \n                        if (requestModel.downloadFailureBlock) {\n                                requestModel.downloadFailureBlock(requestModel.task, error,requestModel.resumeDataFilePath);\n                        }\n                        [self handleRequesFinished:requestModel];\n                    });\n                    \n                }\n                \n            }else {\n                \n                //download succeed\n                [_cacheManager removeCompleteDownloadDataAndClearResumeDataInfoFileWithRequestModel:requestModel];\n                \n                [requestModel.stream close];\n                 requestModel.stream = nil;\n                \n                SJLog(@\"=========== Download succeed,download file path:%@\",requestModel.downloadFilePath);\n                dispatch_async(dispatch_get_main_queue(), ^{\n                    \n                    if (requestModel.downloadSuccessBlock) {\n                        requestModel.downloadSuccessBlock(requestModel.downloadFilePath);\n                    }\n                    [self handleRequesFinished:requestModel];\n                });\n            }\n        }\n    }\n}\n\n\n\n- (void)URLSession:(NSURLSession *)session\n          dataTask:(NSURLSessionDataTask *)dataTask\ndidReceiveResponse:(NSHTTPURLResponse *)response\n completionHandler:(void (^)(NSURLSessionResponseDisposition))completionHandler{\n\n    if (_isDebugMode) {\n        SJLog(@\"=========== Did received response:%@ \\n of task:%@\",response,dataTask);\n    }\n\n    SJNetworkRequestModel * requestModel = [[SJNetworkRequestPool sharedPool].currentRequestModels objectForKey:[NSString stringWithFormat:@\"%ld\",(unsigned long)dataTask.taskIdentifier]];\n\n    if (requestModel) {\n        \n        \n        \n        NSInteger statusCode  = 0;\n        if ([dataTask.response isKindOfClass:[NSHTTPURLResponse class]]) {\n            statusCode = [(NSHTTPURLResponse*)dataTask.response statusCode];\n        }\n        \n        NSString *resumeDataInfoFilePath = requestModel.resumeDataInfoFilePath;\n        NSString *resumeDataFilePath= requestModel.resumeDataFilePath;\n        \n        if (statusCode > 400) {\n            \n            NSError *error = [NSError errorWithDomain:@\"request error\" code:statusCode userInfo:nil];\n            \n            [_fileManager removeItemAtPath:resumeDataInfoFilePath error:nil];\n            \n            if ([_fileManager fileExistsAtPath:resumeDataFilePath]) {\n                [_fileManager removeItemAtPath:resumeDataFilePath error:nil];\n            }\n            \n            \n            SJLog(@\"=========== Download failed,download file path:%@\",requestModel.downloadFilePath);\n            dispatch_async(dispatch_get_main_queue(), ^{\n                \n                if (requestModel.downloadFailureBlock) {\n                    requestModel.downloadFailureBlock(requestModel.task, error,nil);\n                }\n                [self handleRequesFinished:requestModel];\n            });\n            \n            return;\n            \n        }\n        \n        //no error, open stream\n        [requestModel.stream open];\n\n        //load resume data info\n        SJNetworkDownloadResumeDataInfo *dataInfo = [_cacheManager loadResumeDataInfo:requestModel.resumeDataInfoFilePath];\n        if (!dataInfo) {\n            dataInfo = [[SJNetworkDownloadResumeDataInfo alloc] init];\n        }\n\n        //resume data file length\n        NSDictionary *attributeDict = [_fileManager attributesOfItemAtPath:resumeDataFilePath error:nil];\n        NSInteger resumeDataLength = [attributeDict[NSFileSize] integerValue];\n        dataInfo.resumeDataLength = [NSString stringWithFormat:@\"%ld\",(long)resumeDataLength];\n\n        //total data file length\n        NSInteger totalLength = [response.allHeaderFields[@\"Content-Length\"] integerValue] + [dataInfo.resumeDataLength integerValue];\n        dataInfo.totalDataLength = [NSString stringWithFormat:@\"%ld\",(long)totalLength];\n        requestModel.totalLength = totalLength;\n\n        //ratio\n        CGFloat ratio = 1.0 * ([dataInfo.resumeDataLength integerValue])/([dataInfo.totalDataLength integerValue]);\n        dataInfo.resumeDataRatio = [NSString stringWithFormat:@\"%.2f\",ratio];\n\n        [NSKeyedArchiver archiveRootObject:dataInfo toFile:requestModel.resumeDataInfoFilePath];\n\n        completionHandler(NSURLSessionResponseAllow);\n\n    }\n}\n\n\n- (void)URLSession:(NSURLSession *)session\n          dataTask:(NSURLSessionDataTask *)dataTask\n    didReceiveData:(NSData *)data\n{\n\n    SJNetworkRequestModel * requestModel = [[SJNetworkRequestPool sharedPool].currentRequestModels objectForKey:[NSString stringWithFormat:@\"%ld\",(unsigned long)dataTask.taskIdentifier]];\n\n    if (requestModel) {\n\n        //write data in stream\n        [requestModel.stream write:data.bytes maxLength:data.length];\n\n        //update resume data info\n        SJNetworkDownloadResumeDataInfo *dataInfo = [_cacheManager loadResumeDataInfo: requestModel.resumeDataInfoFilePath];\n        NSDictionary *attributeDict = [_fileManager attributesOfItemAtPath:requestModel.resumeDataFilePath error:nil];\n        NSInteger resumeDataLength = [attributeDict[NSFileSize] integerValue];\n        dataInfo.resumeDataLength = [NSString stringWithFormat:@\"%ld\",(long)resumeDataLength];\n        \n        CGFloat ratio = 1.0 * ([dataInfo.resumeDataLength integerValue])/([dataInfo.totalDataLength integerValue]);\n        dataInfo.resumeDataRatio = [NSString stringWithFormat:@\"%.2f\",ratio];\n        [NSKeyedArchiver archiveRootObject:dataInfo toFile:requestModel.resumeDataInfoFilePath];\n\n        if (_isDebugMode) {\n            SJLog(@\"=========== Download progress:%@ of task:%@\",dataInfo.resumeDataRatio,requestModel.task);\n        }\n        if (requestModel.downloadProgressBlock) {\n            requestModel.downloadProgressBlock([dataInfo.resumeDataLength integerValue] ,requestModel.totalLength,ratio);\n        }\n\n    }\n}\n\n\n#pragma mark - ==============  NSURLSessionDownloadDelegate ==============\n\n\n\n\n- (void)URLSession:(NSURLSession *)session\n      downloadTask:(NSURLSessionDownloadTask *)downloadTask\ndidFinishDownloadingToURL:(NSURL *)location\n{\n    \n    SJNetworkRequestModel * requestModel = [[SJNetworkRequestPool sharedPool].currentRequestModels objectForKey:[NSString stringWithFormat:@\"%ld\",(unsigned long)downloadTask.taskIdentifier]];\n    \n    \n    if (requestModel) {\n        \n        \n        NSInteger statusCode  = 0;\n        if ([downloadTask.response isKindOfClass:[NSHTTPURLResponse class]]) {\n            statusCode = [(NSHTTPURLResponse*)downloadTask.response statusCode];\n        }\n                \n        NSString *resumeDataInfoFilePath = requestModel.resumeDataInfoFilePath;\n        NSString *resumeDataFilePath= requestModel.resumeDataFilePath;\n        \n        if (statusCode > 400) {\n            \n            NSError *error = nil;\n            if (statusCode == 416) {\n                error = [NSError errorWithDomain:@\"range error\" code:statusCode userInfo:nil];\n            }\n            \n            [_fileManager removeItemAtPath:resumeDataInfoFilePath error:nil];\n            \n            if ([_fileManager fileExistsAtPath:resumeDataFilePath]) {\n                [_fileManager removeItemAtPath:resumeDataFilePath error:nil];\n            }\n            \n            \n            SJLog(@\"=========== Download failed,download file path:%@\",requestModel.downloadFilePath);\n            dispatch_async(dispatch_get_main_queue(), ^{\n                \n                if (requestModel.downloadFailureBlock) {\n                    requestModel.downloadFailureBlock(requestModel.task, error,nil);\n                }\n                [self handleRequesFinished:requestModel];\n            });\n            \n        }else{\n        \n                \n            NSData *tmpDownloadFileData = [NSData dataWithContentsOfURL:location];\n            NSUInteger downloadDataLength = tmpDownloadFileData.length;\n        \n        \n            //download succeed\n            NSError *moveDownloadFileError = nil;\n            \n            //move temp download data to target file path\n            [_fileManager moveItemAtURL:location toURL:[NSURL fileURLWithPath:requestModel.downloadFilePath] error:&moveDownloadFileError];\n            \n            //remove data info file path\n            [_fileManager removeItemAtPath:resumeDataInfoFilePath error:nil];\n            \n            if ([_fileManager fileExistsAtPath:resumeDataFilePath]) {\n                [_fileManager removeItemAtPath:resumeDataFilePath error:nil];\n            }\n            \n            if (moveDownloadFileError &&  moveDownloadFileError.code != 516) {\n                \n                SJLog(@\"=========== Download failed,download file path:%@\",requestModel.downloadFilePath);\n                \n                 dispatch_async(dispatch_get_main_queue(), ^{\n                     \n                    if (requestModel.downloadFailureBlock) {\n                            requestModel.downloadFailureBlock(requestModel.task, moveDownloadFileError,nil);\n                    }\n                     \n                    [self handleRequesFinished:requestModel];\n                 });\n                \n            }else {\n                \n                if (requestModel.downloadProgressBlock) {\n                    requestModel.downloadProgressBlock(downloadDataLength, downloadDataLength, 1);\n                }\n                \n                if (moveDownloadFileError.code == 516) {\n                    [_fileManager removeItemAtPath:location.absoluteString error:nil];\n                }\n                \n                //succeed block\n                SJLog(@\"=========== Download succeed,download file path:%@\",requestModel.downloadFilePath);\n                dispatch_async(dispatch_get_main_queue(), ^{\n                    \n                    if (requestModel.downloadSuccessBlock) {\n                        requestModel.downloadSuccessBlock(requestModel.downloadFilePath);\n                    }\n                    [self handleRequesFinished:requestModel];\n                });\n            }\n            }\n        }\n}\n\n\n\n- (void)URLSession:(NSURLSession *)session\n      downloadTask:(NSURLSessionDownloadTask *)downloadTask\n      didWriteData:(int64_t)bytesWritten\n totalBytesWritten:(int64_t)totalBytesWritten\ntotalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite\n{\n    \n    SJNetworkRequestModel * requestModel = [[SJNetworkRequestPool sharedPool].currentRequestModels objectForKey:[NSString stringWithFormat:@\"%ld\",(unsigned long)downloadTask.taskIdentifier]];\n    \n    if (requestModel) {\n        \n        if (!requestModel.totalLength) {\n             requestModel.totalLength = (NSInteger)totalBytesExpectedToWrite;\n        }\n        \n        CGFloat ratio = 1.0 *totalBytesWritten/requestModel.totalLength;\n        NSString *resumeDataInfoFilePath = requestModel.resumeDataInfoFilePath;\n        SJNetworkDownloadResumeDataInfo *dataInfo = [_cacheManager loadResumeDataInfo:resumeDataInfoFilePath];\n        \n        dataInfo.resumeDataLength = [NSString stringWithFormat:@\"%lld\",totalBytesWritten];\n        dataInfo.totalDataLength = [NSString stringWithFormat:@\"%ld\",(long)requestModel.totalLength];\n        dataInfo.resumeDataRatio = [NSString stringWithFormat:@\"%.2f\",ratio];\n\n        [NSKeyedArchiver archiveRootObject:dataInfo toFile:resumeDataInfoFilePath];\n        \n        if (_isDebugMode) {\n            SJLog(@\"=========== Download progress:%@ of task:%@\",dataInfo.resumeDataRatio,requestModel.task);\n        }\n        if (requestModel.downloadProgressBlock) {\n            requestModel.downloadProgressBlock((NSInteger)bytesWritten ,requestModel.totalLength,ratio);\n        }\n    }\n    \n    \n}\n\n\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkDownloadResumeDataInfo.h",
    "content": "//\n//  SJNetworkResumeDataInfo.h\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/28.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n\n\n/* =============================\n *\n * SJNetworkDownloadResumeDataInfo\n *\n * SJNetworkDownloadResumeDataInfo is in charge of recording the infomation of resume data of the corresponding download request\n *\n * =============================\n */\n\n@interface SJNetworkDownloadResumeDataInfo : NSObject<NSSecureCoding>\n\n// Record the resume data length\n@property (nonatomic, readwrite, copy) NSString *resumeDataLength;\n\n// Record total length of the download data\n@property (nonatomic, readwrite, copy) NSString *totalDataLength;\n\n// Record the ratio of resume data length and total length of download data (resumeDataLength/dataTotalLength)\n@property (nonatomic, readwrite, copy) NSString *resumeDataRatio;\n\n\n@end\n\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkDownloadResumeDataInfo.m",
    "content": "//\n//  SJNetworkResumeDataInfo.m\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/28.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"SJNetworkDownloadResumeDataInfo.h\"\n\n@implementation SJNetworkDownloadResumeDataInfo\n\n#pragma mark- ============== Life Cycle Methods ==============\n\n- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder {\n    \n    self = [self init];\n    \n    if (self) {\n        \n        self.resumeDataRatio = [aDecoder decodeObjectOfClass:[NSString class] forKey:NSStringFromSelector(@selector(resumeDataRatio))];\n        self.resumeDataLength = [aDecoder decodeObjectOfClass:[NSString class] forKey:NSStringFromSelector(@selector(resumeDataLength))];\n        self.totalDataLength = [aDecoder decodeObjectOfClass:[NSString class] forKey:NSStringFromSelector(@selector(totalDataLength))];\n    }    \n    return self;\n}\n\n#pragma mark- ============== Override Methods ==============\n\n+ (BOOL)supportsSecureCoding {\n    \n    return YES;\n}\n\n- (void)encodeWithCoder:(NSCoder *)aCoder{\n    \n    [aCoder encodeObject:self.resumeDataLength forKey:NSStringFromSelector(@selector(resumeDataLength))];\n    [aCoder encodeObject:self.totalDataLength forKey:NSStringFromSelector(@selector(totalDataLength))];\n    [aCoder encodeObject:self.resumeDataRatio forKey:NSStringFromSelector(@selector(resumeDataRatio))];\n}\n\n\n\n- (NSString *)description{\n    \n    return [NSString stringWithFormat:@\"<%@: %p>:{resume data length:%@}, {total data length:%@},{ratio:%@}\",NSStringFromClass([self class]), self,_resumeDataLength, _totalDataLength, _resumeDataRatio];\n}\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkHeader.h",
    "content": "//\n//  SJNetworkHeader.h\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/12/26.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#ifndef SJNetworkHeader_h\n#define SJNetworkHeader_h\n\n#import <AFNetworking/AFNetworking.h>\n\n//Log used to debug\n#ifdef DEBUG\n#define SJLog(...) NSLog(@\"%s line number:%d \\n %@\\n\\n\",__func__,__LINE__,[NSString stringWithFormat:__VA_ARGS__])\n#else\n#define SJLog(...)\n#endif\n\n\n//============== Callbacks: Only for ordinary request ==================//\ntypedef void(^SJSuccessBlock)(id responseObject);\ntypedef void(^SJFailureBlock)(NSURLSessionTask *task, NSError *error, NSInteger statusCode);\n\n\n//============== Callbacks: Only for upload request ==================//\ntypedef void(^SJUploadSuccessBlock)(id responseObject);\ntypedef void(^SJUploadProgressBlock)(NSProgress *uploadProgress);\ntypedef void(^SJUploadFailureBlock)(NSURLSessionTask *task, NSError *error, NSInteger statusCode, NSArray<UIImage *>*uploadFailedImages);\n\n\n//============== Callbacks: Only for download request ==================//\ntypedef void(^SJDownloadSuccessBlock)(id responseObject);\ntypedef void(^SJDownloadProgressBlock)(NSInteger receivedSize, NSInteger expectedSize, CGFloat progress);\ntypedef void(^SJDownloadFailureBlock)(NSURLSessionTask *task, NSError *error, NSString* resumableDataPath);\n\n\n/**\n *  HTTP Request method\n */\ntypedef NS_ENUM(NSInteger, SJRequestMethod) {\n    \n    SJRequestMethodGET = 60000,\n    SJRequestMethodPOST,\n    SJRequestMethodPUT,\n    SJRequestMethodDELETE,\n    \n};\n\n\n/**\n *  Request type\n */\ntypedef NS_ENUM(NSInteger, SJRequestType) {\n    \n    SJRequestTypeOrdinary = 70000,\n    SJRequestTypeUpload,\n    SJRequestTypeDownload\n    \n};\n\n\n/**\n *  Manual operation by user (start,suspend,resume,cancel)\n */\ntypedef NS_ENUM(NSInteger, SJDownloadManualOperation) {\n    \n    SJDownloadManualOperationStart = 80000,\n    SJDownloadManualOperationSuspend,\n    SJDownloadManualOperationResume,\n    SJDownloadManualOperationCancel,\n    \n};\n\n\n#endif /* SJNetworkHeader_h */\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkManager.h",
    "content": "//\n//  SJNetworkManager.h\n//  SJNetwork\n//\n//  Created by Sun Shijie on 2017/8/16.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n#import <UIKit/UIKit.h>\n\n#import \"SJNetworkRequestModel.h\"\n#import \"SJNetworkCacheManager.h\"\n\n\n/* =============================\n *\n * SJNetworkManager\n *\n * SJNetworkManager is in charge of managing operations of network request\n *\n * =============================\n */\n\n@interface SJNetworkManager : NSObject\n\n\n/**\n *  SJNetworkManager Singleton\n *\n *  @return SJNetworkManager singleton instance\n */\n+ (SJNetworkManager *_Nullable)sharedManager;\n\n\n\n/**\n *  can not use new method\n */\n+ (instancetype _Nullable)new NS_UNAVAILABLE;\n\n\n\n/**\n *  This method is used to add custom header\n *\n *  @param header            custom header added by user\n *\n */\n- (void)addCustomHeader:(NSDictionary *_Nonnull)header;\n\n\n\n/**\n *  This method is used to return custom header\n *\n *  @return custom header\n */\n- (NSDictionary *_Nullable)customHeaders;\n\n\n#pragma mark- Request API using GET method\n\n/**\n *  This method is used to send GET request,\n not consider whether to write cache & not consider whether to load cache\n *\n *  @param url                 request url\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendGetRequest:(NSString * _Nonnull)url\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n\n/**\n *  This method is used to send GET request,\n not consider whether to write cache & not consider whether to load cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendGetRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n/**\n *  This method is used to send GET request,\n consider whether to load cache but not consider whether to write cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param loadCache           consider whether to load cache\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendGetRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n             loadCache:(BOOL)loadCache\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n/**\n *  This method is used to send GET request,\n consider whether to write cache but not consider whether to load cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param cacheDuration       consider whether to write cache\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendGetRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n         cacheDuration:(NSTimeInterval)cacheDuration\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n/**\n *  This method is used to send GET request,\n consider whether to load cache and consider whether to write cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param loadCache           consider whether to load cache\n *  @param cacheDuration       consider whether to write cache\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendGetRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n             loadCache:(BOOL)loadCache\n         cacheDuration:(NSTimeInterval)cacheDuration\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n#pragma mark- Request API using POST method\n\n/**\n *  This method is used to send POST request,\n not consider whether to write cache & not consider whether to load cache\n *\n *  @param url                request url\n *  @param parameters         parameters\n *  @param successBlock       success callback\n *  @param failureBlock       failure callback\n *\n */\n- (void)sendPostRequest:(NSString * _Nonnull)url\n             parameters:(id _Nullable)parameters\n                success:(SJSuccessBlock _Nullable)successBlock\n                failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n/**\n *  This method is used to send POST request,\n consider whether to load cache but not consider whether to write cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param loadCache           consider whether to load cache\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendPostRequest:(NSString * _Nonnull)url\n             parameters:(id _Nullable)parameters\n              loadCache:(BOOL)loadCache\n                success:(SJSuccessBlock _Nullable)successBlock\n                failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n/**\n *  This method is used to send POST request,\n consider whether to write cache but not consider whether to load cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param cacheDuration       consider whether to write cache\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendPostRequest:(NSString * _Nonnull)url\n             parameters:(id _Nullable)parameters\n          cacheDuration:(NSTimeInterval)cacheDuration\n                success:(SJSuccessBlock _Nullable)successBlock\n                failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n/**\n *  This method is used to send POST request,\n consider whether to load cache and consider whether to write cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param loadCache           consider whether to load cache\n *  @param cacheDuration       consider whether to write cache\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendPostRequest:(NSString * _Nonnull)url\n             parameters:(id _Nullable)parameters\n              loadCache:(BOOL)loadCache\n          cacheDuration:(NSTimeInterval)cacheDuration\n                success:(SJSuccessBlock _Nullable)successBlock\n                failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n#pragma mark- Request API using PUT method\n\n\n/**\n *  This method is used to send PUT request,\n not consider whether to write cache & not consider whether to load cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendPutRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n/**\n *  This method is used to send POST request,\n consider whether to load cache but not consider whether to write cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param loadCache           consider whether to load cache\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendPutRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n             loadCache:(BOOL)loadCache\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n/**\n *  This method is used to send POST request,\n consider whether to write cache but not consider whether to load cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param cacheDuration       consider whether to write cache\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendPutRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n         cacheDuration:(NSTimeInterval)cacheDuration\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n/**\n *  This method is used to send POST request,\n consider whether to load cache and consider whether to write cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param loadCache           consider whether to load cache\n *  @param cacheDuration       consider whether to write cache\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendPutRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n             loadCache:(BOOL)loadCache\n         cacheDuration:(NSTimeInterval)cacheDuration\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n#pragma mark- Request API using DELETE method\n\n/**\n *  This method is used to send DELETE request,\n not consider whether to write cache & not consider whether to load cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendDeleteRequest:(NSString * _Nonnull)url\n               parameters:(id _Nullable)parameters\n                  success:(SJSuccessBlock _Nullable)successBlock\n                  failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n/**\n *  This method is used to send POST request,\n consider whether to load cache but not consider whether to write cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param loadCache           consider whether to load cache\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendDeleteRequest:(NSString * _Nonnull)url\n               parameters:(id _Nullable)parameters\n                loadCache:(BOOL)loadCache\n                  success:(SJSuccessBlock _Nullable)successBlock\n                  failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n/**\n *  This method is used to send POST request,\n consider whether to write cache but not consider whether to load cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param cacheDuration       consider whether to write cache\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendDeleteRequest:(NSString * _Nonnull)url\n               parameters:(id _Nullable)parameters\n            cacheDuration:(NSTimeInterval)cacheDuration\n                  success:(SJSuccessBlock _Nullable)successBlock\n                  failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n/**\n *  This method is used to send POST request,\n consider whether to load cache and consider whether to write cache\n *\n *  @param url                 request url\n *  @param parameters          parameters\n *  @param loadCache           consider whether to load cache\n *  @param cacheDuration       consider whether to write cache\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendDeleteRequest:(NSString * _Nonnull)url\n               parameters:(id _Nullable)parameters\n                loadCache:(BOOL)loadCache\n            cacheDuration:(NSTimeInterval)cacheDuration\n                  success:(SJSuccessBlock _Nullable)successBlock\n                  failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n#pragma mark- Request API using specific parameters\n\n/**\n *  These methods are used to send request with specific parameters:\n \n 1. if the parameters object is nil,then send GET request\n 2. if the parameters object is not nil,then send POST request\n */\n\n\n/**\n *  This method is used to send request with specific parameters,\n not consider whether to write cache & not consider whether to load cache\n *\n *  @param url                request url\n *  @param parameters         parameters\n *  @param successBlock       success callback\n *  @param failureBlock       failure callback\n *\n */\n- (void)sendRequest:(NSString * _Nonnull)url\n         parameters:(id _Nullable)parameters\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n/**\n *  This method is used to send request with specific parameters,\n not consider whether to write cache but consider whether to load cache\n \n *\n *  @param url                request url\n *  @param parameters         parameters\n *  @param loadCache          consider whether to load cache\n *  @param successBlock       success callback\n *  @param failureBlock       failure callback\n *\n */\n- (void)sendRequest:(NSString * _Nonnull)url\n         parameters:(id _Nullable)parameters\n          loadCache:(BOOL)loadCache\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n/**\n * This method is used to send request with specific parameters,\n not consider whether to load cache but consider whether to write cache\n \n *\n *  @param url                request url\n *  @param parameters         parameters\n *  @param cacheDuration      consider whether to write cache\n *  @param successBlock       success callback\n *  @param failureBlock       failure callback\n *\n */\n- (void)sendRequest:(NSString * _Nonnull)url\n         parameters:(id _Nullable)parameters\n      cacheDuration:(NSTimeInterval)cacheDuration\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n/**\n *  This method is used to send request with specific parameters,\n consider whether to load cache and consider whether to write cache\n \n *\n *  @param url                request url\n *  @param parameters         parameters\n *  @param loadCache          consider whether to load cache\n *  @param cacheDuration      consider whether to write cache\n *  @param successBlock       success callback\n *  @param failureBlock       failure callback\n *\n */\n- (void)sendRequest:(NSString * _Nonnull)url\n         parameters:(id _Nullable)parameters\n          loadCache:(BOOL)loadCache\n      cacheDuration:(NSTimeInterval)cacheDuration\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n\n//================== Request API using specific request method ==================//\n\n\n/**\n *  This method is used to send request with specific method(GET,POST,PUT,DELETE),\n *  not consider whether to write cache & not consider whether to load cache\n *\n *  @param url                 request url\n *  @param method              request method\n *  @param parameters          parameters\n *  @param successBlock        success callback\n *  @param failureBlock        failure callback\n *\n */\n- (void)sendRequest:(NSString * _Nonnull)url\n             method:(SJRequestMethod)method\n         parameters:(id _Nullable)parameters\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n\n/**\n *  This method is used to send request with specific method(GET,POST,PUT,DELETE),\n *  not consider whether to write cache but consider whether to load cache\n *\n *  @param url                request url\n *  @param method             request method\n *  @param parameters         parameters\n *  @param loadCache          consider whether to load cache\n *  @param successBlock       success callback\n *  @param failureBlock       failure callback\n *\n */\n- (void)sendRequest:(NSString * _Nonnull)url\n             method:(SJRequestMethod)method\n         parameters:(id _Nullable)parameters\n          loadCache:(BOOL)loadCache\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n\n\n\n/**\n *  This method is used to send request with specific method(GET,POST,PUT,DELETE),\n *  not consider whether to load cache but consider whether to write cache\n *\n *  @param url                request url\n *  @param method             request method\n *  @param parameters         parameters\n *  @param cacheDuration      consider whether to write cache\n *  @param successBlock       success callback\n *  @param failureBlock       failure callback\n *\n */\n- (void)sendRequest:(NSString * _Nonnull)url\n             method:(SJRequestMethod)method\n         parameters:(id _Nullable)parameters\n      cacheDuration:(NSTimeInterval)cacheDuration\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n\n/**\n *  This method is used to send request with specific method(GET,POST,PUT,DELETE),\n *  consider whether to load cache but consider whether to write cache\n *\n *  @param url                request url\n *  @param method             request method\n *  @param parameters         parameters\n *  @param loadCache          consider whether to load cache\n *  @param cacheDuration      consider whether to write cache\n *  @param successBlock       success callback\n *  @param failureBlock       failure callback\n *\n */\n- (void)sendRequest:(NSString * _Nonnull)url\n             method:(SJRequestMethod)method\n         parameters:(id _Nullable)parameters\n          loadCache:(BOOL)loadCache\n      cacheDuration:(NSTimeInterval)cacheDuration\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n#pragma mark- Request API upload images\n\n\n/**\n *  This method is used to upload image\n *\n *  @param url                   request url\n *  @param parameters            parameters\n *  @param image                 UIImage object\n *  @param name                  file name\n *  @param mimeType              file type\n *  @param uploadProgressBlock   upload progress callback\n *  @param uploadSuccessBlock    uploadSuccess allback\n *  @param uploadFailureBlock    upload failure callback\n *\n */\n- (void)sendUploadImageRequest:(NSString * _Nonnull)url\n                    parameters:(id _Nullable)parameters\n                         image:(UIImage * _Nonnull)image\n                          name:(NSString * _Nonnull)name\n                      mimeType:(NSString * _Nullable)mimeType\n                      progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                       success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                       failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock;\n\n\n/**\n *  This method is used to upload image\n *\n *  @param url                   request url\n *  @param ignoreBaseUrl         consider whether to ignore configured base url\n *  @param parameters            parameters\n *  @param image                 UIImage object\n *  @param name                  file name\n *  @param mimeType              file type\n *  @param uploadProgressBlock   upload progress callback\n *  @param uploadSuccessBlock    upload success callback\n *  @param uploadFailureBlock    upload failure callback\n *\n */\n- (void)sendUploadImageRequest:(NSString * _Nonnull)url\n                 ignoreBaseUrl:(BOOL)ignoreBaseUrl\n                    parameters:(id _Nullable)parameters\n                         image:(UIImage * _Nonnull)image\n                          name:(NSString * _Nonnull)name\n                      mimeType:(NSString * _Nullable)mimeType\n                      progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                       success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                       failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock;\n\n\n\n/**\n *  This method is used to upload images(or only one image)\n *\n *  @param url                   request url\n *  @param parameters            parameters\n *  @param images                UIImage object array\n *  @param name                  file name\n *  @param mimeType              file type\n *  @param uploadProgressBlock   upload progress callback\n *  @param uploadSuccessBlock    upload success callback\n *  @param uploadFailureBlock    upload failure callback\n *\n */\n- (void)sendUploadImagesRequest:(NSString * _Nonnull)url\n                     parameters:(id _Nullable)parameters\n                         images:(NSArray<UIImage *> * _Nonnull)images\n                           name:(NSString * _Nonnull)name\n                       mimeType:(NSString * _Nullable)mimeType\n                       progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                        success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                        failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock;\n\n\n\n/**\n *  This method is used to upload images(or only one image)\n *\n *  @param url                   request url\n *  @param ignoreBaseUrl         consider whether to ignore configured base url\n *  @param parameters            parameters\n *  @param images                UIImage object array\n *  @param name                  file name\n *  @param mimeType              file type\n *  @param uploadProgressBlock   upload progress callback\n *  @param uploadSuccessBlock    upload success callback\n *  @param uploadFailureBlock    upload failure callback\n *\n */\n- (void)sendUploadImagesRequest:(NSString * _Nonnull)url\n                  ignoreBaseUrl:(BOOL)ignoreBaseUrl\n                     parameters:(id _Nullable)parameters\n                         images:(NSArray<UIImage *> * _Nonnull)images\n                           name:(NSString * _Nonnull)name\n                       mimeType:(NSString * _Nullable)mimeType\n                       progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                        success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                        failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock;\n\n\n\n/**\n *  This method is used to upload image\n *\n *  @param url                   request url\n *  @param parameters            parameters\n *  @param image                 UIImage object\n *  @param compressRatio         compress ratio of images\n *  @param name                  file name\n *  @param mimeType              file type\n *  @param uploadProgressBlock   upload progress callback\n *  @param uploadSuccessBlock    upload success callback\n *  @param uploadFailureBlock    upload failure callback\n *\n */\n- (void)sendUploadImageRequest:(NSString * _Nonnull)url\n                    parameters:(id _Nullable)parameters\n                         image:(UIImage * _Nonnull)image\n                 compressRatio:(float)compressRatio\n                          name:(NSString * _Nonnull)name\n                      mimeType:(NSString * _Nullable)mimeType\n                      progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                       success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                       failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock;\n\n\n/**\n *  This method is used to upload image\n *\n *  @param url                   request url\n *  @param ignoreBaseUrl         consider whether to ignore configured base url\n *  @param parameters            parameters\n *  @param image                 UIImage object\n *  @param compressRatio         compress ratio of images\n *  @param name                  file name\n *  @param mimeType              file type\n *  @param uploadProgressBlock   upload progress callback\n *  @param uploadSuccessBlock    upload success callback\n *  @param uploadFailureBlock    upload failure callback\n *\n */\n- (void)sendUploadImageRequest:(NSString * _Nonnull)url\n                 ignoreBaseUrl:(BOOL)ignoreBaseUrl\n                    parameters:(id _Nullable)parameters\n                         image:(UIImage * _Nonnull)image\n                 compressRatio:(float)compressRatio\n                          name:(NSString * _Nonnull)name\n                      mimeType:(NSString * _Nullable)mimeType\n                      progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                       success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                       failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock;\n\n\n\n\n/**\n *  This method is used to upload images(or only one image)\n *\n *  @param url                   request url\n *  @param parameters            parameters\n *  @param images                UIImage object array\n *  @param compressRatio         compress ratio of images\n *  @param name                  file name\n *  @param mimeType              file type\n *  @param uploadProgressBlock   upload progress callback\n *  @param uploadSuccessBlock    upload success callback\n *  @param uploadFailureBlock    upload failure callback\n *\n */\n- (void)sendUploadImagesRequest:(NSString * _Nonnull)url\n                     parameters:(id _Nullable)parameters\n                         images:(NSArray<UIImage *> * _Nonnull)images\n                  compressRatio:(float)compressRatio\n                           name:(NSString * _Nonnull)name\n                       mimeType:(NSString * _Nullable)mimeType\n                       progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                        success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                        failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock;\n\n\n\n\n/**\n *\n *  @param url                   request url\n *  @param ignoreBaseUrl         consider whether to ignore configured base url\n *  @param parameters            parameters\n *  @param images                UIImage object array\n *  @param compressRatio         compress ratio of images\n *  @param name                  file name\n *  @param mimeType              file type\n *  @param uploadProgressBlock   upload progress callback\n *  @param uploadSuccessBlock    upload success callback\n *  @param uploadFailureBlock    upload failure callback\n *\n */\n- (void)sendUploadImagesRequest:(NSString * _Nonnull)url\n                  ignoreBaseUrl:(BOOL)ignoreBaseUrl\n                     parameters:(id _Nullable)parameters\n                         images:(NSArray<UIImage *> * _Nonnull)images\n                  compressRatio:(float)compressRatio\n                           name:(NSString * _Nonnull)name\n                       mimeType:(NSString * _Nullable)mimeType\n                       progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                        success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                        failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock;\n\n\n\n\n\n\n#pragma mark- Request API download files\n\n/**\n *  These methods are used to download file\n *\n *  @param url                      request url\n *  @param downloadFilePath         target path of download file\n *  @param downloadProgressBlock    download progress callback\n *  @param downloadSuccessBlock     download success callback\n *  @param downloadFailureBlock     download failure callback\n *\n */\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock;\n\n\n\n\n\n/**\n *  These methods are used to download file\n *\n *  @param url                      request url\n *  @param ignoreBaseUrl            consider whether to ignore configured base url\n *  @param downloadFilePath         target path of download file\n *  @param downloadProgressBlock    download progress callback\n *  @param downloadSuccessBlock     download success callback\n *  @param downloadFailureBlock     download failure callback\n *\n */\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n              ignoreBaseUrl:(BOOL)ignoreBaseUrl\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock;\n\n\n\n\n\n\n/**\n *  These methods are used to download file\n *\n *  @param url                      request url\n *  @param downloadFilePath         target path of download file\n *  @param resumable                consider whether to save or load resumble data\n *  @param downloadProgressBlock    download progress callback\n *  @param downloadSuccessBlock     download success callback\n *  @param downloadFailureBlock     download failure callback\n *\n */\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                  resumable:(BOOL)resumable\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock;\n\n\n\n/**\n *  These methods are used to download file\n *\n *  @param url                      request url\n *  @param ignoreBaseUrl            consider whether to ignore configured base url\n *  @param downloadFilePath         target path of download file\n *  @param resumable                consider whether to save or load resumble data\n *  @param downloadProgressBlock    download progress callback\n *  @param downloadSuccessBlock     download success callback\n *  @param downloadFailureBlock     download failure callback\n *\n */\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n              ignoreBaseUrl:(BOOL)ignoreBaseUrl\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                  resumable:(BOOL)resumable\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock;\n\n\n\n/**\n *  These methods are used to download file\n *\n *  @param url                      request url\n *  @param downloadFilePath         target path of download file\n *  @param backgroundSupport        consider whether to support background downlaod\n *  @param downloadProgressBlock    download progress callback\n *  @param downloadSuccessBlock     download success callback\n *  @param downloadFailureBlock     download failure callback\n *\n */\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n          backgroundSupport:(BOOL)backgroundSupport\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock;\n\n\n\n\n/**\n *  These methods are used to download file\n *\n *  @param url                      request url\n *  @param ignoreBaseUrl            consider whether to ignore configured base url\n *  @param downloadFilePath         target path of download file\n *  @param backgroundSupport        consider whether to support background downlaod\n *  @param downloadProgressBlock    download progress callback\n *  @param downloadSuccessBlock     download success callback\n *  @param downloadFailureBlock     download failure callback\n *\n */\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n              ignoreBaseUrl:(BOOL)ignoreBaseUrl\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n          backgroundSupport:(BOOL)backgroundSupport\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock;\n\n\n/**\n *  These methods are used to download file\n *\n *  @param url                      request url\n *  @param downloadFilePath         target path of download file\n *  @param resumable                consider whether to save or load resumble data\n *  @param backgroundSupport        consider whether to support background downlaod\n *  @param downloadProgressBlock    download progress callback\n *  @param downloadSuccessBlock     download success callback\n *  @param downloadFailureBlock     download failure callback\n *\n */\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                  resumable:(BOOL)resumable\n          backgroundSupport:(BOOL)backgroundSupport\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock;\n\n\n\n\n/**\n *  These methods are used to download file\n *\n *  @param url                      request url\n *  @param ignoreBaseUrl            consider whether to ignore configured base url\n *  @param downloadFilePath         target path of download file\n *  @param resumable                consider whether to save or load resumble data\n *  @param backgroundSupport        consider whether to support background downlaod\n *  @param downloadProgressBlock    download progress callback\n *  @param downloadSuccessBlock     download success callback\n *  @param downloadFailureBlock     download failure callback\n *\n */\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n              ignoreBaseUrl:(BOOL)ignoreBaseUrl\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                  resumable:(BOOL)resumable\n          backgroundSupport:(BOOL)backgroundSupport\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock;\n\n\n//=============================== Suspend download requests ==================================//\n\n\n/**\n *  This method is used to suspend all current download requests\n */\n- (void)suspendAllDownloadRequests;\n\n\n\n\n\n/**\n *  This method is used to suspend a download request with given url\n *\n *  @param url                   download url\n *\n */\n- (void)suspendDownloadRequest:(NSString * _Nonnull)url;\n\n\n\n/**\n *  This method is used to suspend a download request with given url which contains the baseUrl or not\n *\n *  @param url                   download url\n *  @param ignoreBaseUrl         ignore baseUrl or not\n *\n */\n- (void)suspendDownloadRequest:(NSString * _Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n/**\n *  This method is used to suspend one nor more download requests with given urls array\n *\n *  @param urls                   download url array\n *\n */\n- (void)suspendDownloadRequests:(NSArray *_Nonnull)urls;\n\n\n\n\n/**\n *  This method is used to suspend one nor more download requests with given urls which contain the baseUrl or not\n *\n *  @param urls                   download url array\n *  @param ignoreBaseUrl          ignore baseUrl or not\n *\n */\n- (void)suspendDownloadRequests:(NSArray *_Nonnull)urls ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n//=============================== Resume download requests ==================================//\n\n/**\n *  This method is used to resume all suspended download requests\n */\n- (void)resumeAllDownloadRequests;\n\n\n\n\n/**\n *  This method is used to resume a suspended request with given url\n *\n *  @param url                   download url\n *\n */\n- (void)resumeDownloadReqeust:(NSString *_Nonnull)url;\n\n\n\n\n/**\n *  This method is used to resume a suspended request with given url which contains the baseUrl or not\n *\n *  @param url                   download url\n *  @param ignoreBaseUrl         ignore baseUrl or not\n *\n */\n- (void)resumeDownloadReqeust:(NSString *_Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n/**\n *  This method is used to resume one nor more suspended requests with given urls array\n *\n *  @param urls                   download url array\n *\n */\n- (void)resumeDownloadReqeusts:(NSArray *_Nonnull)urls;\n\n\n\n/**\n *  This method is used to suspend one nor more suspended requests with given urls which contain the baseUrl or not\n *\n *  @param urls                   download url array\n *  @param ignoreBaseUrl          ignore baseUrl or not\n *\n */\n- (void)resumeDownloadReqeusts:(NSArray *_Nonnull)urls ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n\n\n//=============================== Cancel download requests ==================================//\n\n\n/**\n *  This method is used to cancel all current download requests\n */\n- (void)cancelAllDownloadRequests;\n\n\n\n/**\n *  This method is used to cancel a current download request with given url\n *\n *  @param url                   download url\n *\n */\n- (void)cancelDownloadRequest:(NSString * _Nonnull)url;\n\n\n\n/**\n *  This method is used to cancel a current download request with given url which contains the baseUrl or not\n *\n *  @param url                   download url\n *  @param ignoreBaseUrl         ignore baseUrl or not\n *\n */\n- (void)cancelDownloadRequest:(NSString * _Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n\n/**\n *  This method is used to cancel one nor more current download requests with given urls array\n *\n *  @param urls                   download url array\n *\n */\n- (void)cancelDownloadRequests:(NSArray *_Nonnull)urls;\n\n\n\n\n/**\n *  This method is used to cancel one nor more current download requests with given urls which contain the baseUrl or not\n *\n *  @param urls                   download url array\n *  @param ignoreBaseUrl          ignore baseUrl or not\n *\n */\n- (void)cancelDownloadRequests:(NSArray *_Nonnull)urls ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n/**\n *  This method is used to get incomplete download data ratio of a download request with a given download url\n *\n *  @param url                    download url\n *\n *  @return incomplete download data ratio\n */\n- (CGFloat)resumeDataRatioOfRequest:(NSString *_Nonnull)url;\n\n\n\n\n\n/**\n *  This method is used to get incomplete download data ratio of a download request with a given download url which contains the baseUrl or not\n *\n *  @param url                    download url\n *  @param ignoreBaseUrl          ignore baseUrl or not\n *\n *  @return incomplete download data ratio\n */\n- (CGFloat)resumeDataRatioOfRequest:(NSString *_Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl;\n\n\n\n#pragma mark- Cancel requests\n\n\n\n/**\n *  This method is used to cancel all current requests\n */\n- (void)cancelAllCurrentRequests;\n\n\n\n\n/**\n *  This method is used to cancel all current requests corresponding a reqeust url,\n    no matter what the method is and parameters are\n *\n *  @param url              request url\n *\n */\n- (void)cancelCurrentRequestWithUrl:(NSString * _Nonnull)url;\n\n\n\n\n\n\n/**\n *  This method is used to cancel all current requests corresponding a specific reqeust url, method and parameters\n *\n *  @param url              request url\n *  @param method           request method\n *  @param parameters       parameters\n *\n */\n- (void)cancelCurrentRequestWithUrl:(NSString * _Nonnull)url\n                             method:(NSString * _Nonnull)method\n                         parameters:(id _Nullable)parameters;\n\n\n\n\n#pragma mark- Cache operations\n\n\n//=============================== Load cache ==================================//\n\n/**\n *  This method is used to load cache which is related to a specific url,\n    no matter what request method is or parameters are\n *\n *\n *  @param url                  the url of related network requests\n *  @param completionBlock      callback\n *\n */\n- (void)loadCacheWithUrl:(NSString * _Nonnull)url\n         completionBlock:(SJLoadCacheArrCompletionBlock _Nullable)completionBlock;\n\n\n\n\n\n\n/**\n *  This method is used to load cache which is related to a specific url,method and parameters\n *\n *  @param url                  the url of the network request\n *  @param method               the method of the network request\n *  @param parameters           the parameters of the network request\n *  @param completionBlock      callback\n *\n */\n- (void)loadCacheWithUrl:(NSString * _Nonnull)url\n                  method:(NSString * _Nonnull)method\n              parameters:(id _Nullable)parameters\n         completionBlock:(SJLoadCacheCompletionBlock _Nullable)completionBlock;\n\n\n\n\n//=============================== calculate cache ===========================//\n\n/**\n *  This method is used to calculate the size of the cache folder\n *\n *  @param completionBlock      callback\n *\n */\n- (void)calculateCacheSizeCompletionBlock:(SJCalculateSizeCompletionBlock _Nullable)completionBlock;\n\n\n\n\n\n//================================= clear cache ==============================//\n\n/**\n *  This method is used to clear all cache which is in the cache file\n *\n *  @param completionBlock      callback\n *\n */\n- (void)clearAllCacheCompletionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock;\n\n\n\n\n/**\n *  This method is used to clear the cache which is related the specific url,\n    no matter what request method is or parameters are\n *\n *  @param url                   the url of network request\n *  @param completionBlock       callback\n *\n */\n- (void)clearCacheWithUrl:(NSString * _Nonnull)url\n          completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock;\n\n\n\n\n\n- (void)clearCacheWithUrl:(NSString * _Nonnull)url\n                   method:(NSString * _Nonnull)method\n          completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock;\n\n\n\n\n/**\n *  This method is used to clear the cache which is related the specific url and method,\n    no matter what parameters are\n *\n *  @param url                   the url of network request\n *  @param method                request method\n *  @param completionBlock       callback\n *\n */\n- (void)loadCacheWithUrl:(NSString * _Nonnull)url\n                  method:(NSString * _Nonnull)method\n         completionBlock:(SJLoadCacheArrCompletionBlock _Nullable)completionBlock;\n\n\n\n/**\n *  This method is used to clear cache which is related to a specific url,method and parameters\n *\n *  @param url                  the url of the network request\n *  @param method               the method of the network request\n *  @param parameters           the parameters of the network request\n *  @param completionBlock      callback\n *\n */\n- (void)clearCacheWithUrl:(NSString * _Nonnull)url\n                   method:(NSString * _Nonnull)method\n               parameters:(id _Nonnull)parameters\n          completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock;\n\n\n\n#pragma mark- Request Info\n\n\n/**\n *  This method is used to log all current requests' information\n */\n- (void)logAllCurrentRequests;\n\n\n\n/**\n *  This method is used to check if there is remaining curent request\n *\n *  @return if there is remaining requests\n */\n- (BOOL)remainingCurrentRequests;\n\n\n\n/**\n *  This method is used to calculate the count of current requests\n *\n *  @return the count of current requests\n */\n- (NSInteger)currentRequestCount;\n\n\n\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkManager.m",
    "content": "//\n//  SJNetworkManager.m\n//  SJNetwork\n//\n//  Created by Sun Shijie on 2017/8/16.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"SJNetworkManager.h\"\n\n#import \"SJNetworkConfig.h\"\n#import \"SJNetworkRequestPool.h\"\n\n#import \"SJNetworkRequestEngine.h\"\n#import \"SJNetworkUploadEngine.h\"\n#import \"SJNetworkDownloadEngine.h\"\n\n@interface SJNetworkManager()\n\n@property (nonatomic, strong) SJNetworkRequestEngine *requestEngine;\n@property (nonatomic, strong) SJNetworkUploadEngine *uploadEngine;\n@property (nonatomic, strong) SJNetworkDownloadEngine *downloadEngine;\n\n@property (nonatomic, strong) SJNetworkRequestPool *requestPool;\n@property (nonatomic, strong) SJNetworkCacheManager *cacheManager;\n\n@end\n\n\n@implementation SJNetworkManager\n\n\n#pragma mark- ============== Life Cycle ===========\n\n+ (SJNetworkManager *_Nullable)sharedManager {\n    \n    static SJNetworkManager *sharedManager = NULL;\n    static dispatch_once_t onceToken;\n    \n    dispatch_once(&onceToken, ^{\n         sharedManager = [[SJNetworkManager alloc] init];\n    });\n    return sharedManager;\n}\n\n\n- (void)dealloc{\n    \n    [self cancelAllCurrentRequests];\n}\n\n#pragma mark- ============== Public Methods ==============\n\n\n- (void)addCustomHeader:(NSDictionary *_Nonnull)header{\n    \n    [[SJNetworkConfig sharedConfig] addCustomHeader:header];\n}\n\n\n\n\n- (NSDictionary *_Nullable)customHeaders{\n    \n    return [SJNetworkConfig sharedConfig].customHeaders;\n}\n\n\n#pragma mark- ============== Request API using GET method ==============\n\n\n- (void)sendGetRequest:(NSString * _Nonnull)url\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodGET\n                          parameters:nil\n                           loadCache:NO\n                       cacheDuration:0\n                             success:successBlock\n                             failure:failureBlock];\n    \n}\n\n\n\n\n\n- (void)sendGetRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodGET\n                          parameters:parameters\n                           loadCache:NO\n                       cacheDuration:0\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n- (void)sendGetRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n             loadCache:(BOOL)loadCache\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodGET\n                          parameters:parameters\n                           loadCache:loadCache\n                       cacheDuration:0\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n\n- (void)sendGetRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n         cacheDuration:(NSTimeInterval)cacheDuration\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock{\n\n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodGET\n                          parameters:parameters\n                           loadCache:NO\n                       cacheDuration:cacheDuration\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n\n- (void)sendGetRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n             loadCache:(BOOL)loadCache\n         cacheDuration:(NSTimeInterval)cacheDuration\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodGET\n                          parameters:parameters\n                           loadCache:loadCache\n                       cacheDuration:cacheDuration\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n#pragma mark- ============== Request API using POST method ==============\n\n- (void)sendPostRequest:(NSString * _Nonnull)url\n             parameters:(id _Nullable)parameters\n                success:(SJSuccessBlock _Nullable)successBlock\n                failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodPOST\n                          parameters:parameters\n                           loadCache:NO\n                       cacheDuration:0\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n- (void)sendPostRequest:(NSString * _Nonnull)url\n             parameters:(id _Nullable)parameters\n              loadCache:(BOOL)loadCache\n                success:(SJSuccessBlock _Nullable)successBlock\n                failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodPOST\n                          parameters:parameters\n                           loadCache:loadCache\n                       cacheDuration:0\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n- (void)sendPostRequest:(NSString * _Nonnull)url\n             parameters:(id _Nullable)parameters\n          cacheDuration:(NSTimeInterval)cacheDuration\n                success:(SJSuccessBlock _Nullable)successBlock\n                failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodPOST\n                          parameters:parameters\n                           loadCache:NO\n                       cacheDuration:cacheDuration\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n\n- (void)sendPostRequest:(NSString * _Nonnull)url\n             parameters:(id _Nullable)parameters\n              loadCache:(BOOL)loadCache\n          cacheDuration:(NSTimeInterval)cacheDuration\n                success:(SJSuccessBlock _Nullable)successBlock\n                failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodPOST\n                          parameters:parameters\n                           loadCache:loadCache\n                       cacheDuration:cacheDuration\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n\n#pragma mark- ============== Request API using PUT method ==============\n\n- (void)sendPutRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodPUT\n                          parameters:parameters\n                           loadCache:NO\n                       cacheDuration:0\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n- (void)sendPutRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n             loadCache:(BOOL)loadCache\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodPUT\n                          parameters:parameters\n                           loadCache:loadCache\n                       cacheDuration:0\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n- (void)sendPutRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n         cacheDuration:(NSTimeInterval)cacheDuration\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodPUT\n                          parameters:parameters\n                           loadCache:NO\n                       cacheDuration:cacheDuration\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n- (void)sendPutRequest:(NSString * _Nonnull)url\n            parameters:(id _Nullable)parameters\n             loadCache:(BOOL)loadCache\n         cacheDuration:(NSTimeInterval)cacheDuration\n               success:(SJSuccessBlock _Nullable)successBlock\n               failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodPUT\n                          parameters:parameters\n                           loadCache:loadCache\n                       cacheDuration:cacheDuration\n                             success:successBlock\n                             failure:failureBlock];\n    \n}\n\n\n\n#pragma mark- ============== Request API using DELETE method ==============\n\n- (void)sendDeleteRequest:(NSString * _Nonnull)url\n               parameters:(id _Nullable)parameters\n                  success:(SJSuccessBlock _Nullable)successBlock\n                  failure:(SJFailureBlock _Nullable)failureBlock{\n\n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodDELETE\n                          parameters:parameters\n                           loadCache:NO\n                       cacheDuration:0\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n- (void)sendDeleteRequest:(NSString * _Nonnull)url\n               parameters:(id _Nullable)parameters\n                loadCache:(BOOL)loadCache\n                  success:(SJSuccessBlock _Nullable)successBlock\n                  failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodDELETE\n                          parameters:parameters\n                           loadCache:loadCache\n                       cacheDuration:0\n                             success:successBlock\n                             failure:failureBlock];\n    \n}\n\n\n\n\n- (void)sendDeleteRequest:(NSString * _Nonnull)url\n               parameters:(id _Nullable)parameters\n            cacheDuration:(NSTimeInterval)cacheDuration\n                  success:(SJSuccessBlock _Nullable)successBlock\n                  failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodDELETE\n                          parameters:parameters\n                           loadCache:NO\n                       cacheDuration:cacheDuration\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n- (void)sendDeleteRequest:(NSString * _Nonnull)url\n               parameters:(id _Nullable)parameters\n                loadCache:(BOOL)loadCache\n            cacheDuration:(NSTimeInterval)cacheDuration\n                  success:(SJSuccessBlock _Nullable)successBlock\n                  failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:SJRequestMethodDELETE\n                          parameters:parameters\n                           loadCache:loadCache\n                       cacheDuration:cacheDuration\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n\n#pragma mark- ============== Request API using specific parameters ==============\n\n\n- (void)sendRequest:(NSString * _Nonnull)url\n         parameters:(id _Nullable)parameters\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock{\n    \n    if (parameters) {\n        \n         [self.requestEngine sendRequest:url\n                                  method:SJRequestMethodPOST\n                              parameters:parameters\n                               loadCache:NO\n                           cacheDuration:0\n                                 success:successBlock\n                                 failure:failureBlock];\n        \n    }else{\n        \n         [self.requestEngine sendRequest:url\n                                  method:SJRequestMethodGET\n                              parameters:nil\n                               loadCache:NO\n                           cacheDuration:0\n                                 success:successBlock\n                                 failure:failureBlock];\n    }\n}\n\n\n\n\n\n- (void)sendRequest:(NSString * _Nonnull)url\n         parameters:(id _Nullable)parameters\n          loadCache:(BOOL)loadCache\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock{\n    \n    if (parameters) {\n    \n         [self.requestEngine sendRequest:url\n                                  method:SJRequestMethodPOST\n                              parameters:parameters\n                               loadCache:loadCache\n                           cacheDuration:0\n                                 success:successBlock\n                                 failure:failureBlock];\n        \n    }else{\n        \n         [self.requestEngine sendRequest:url\n                                  method:SJRequestMethodGET\n                              parameters:nil\n                               loadCache:loadCache\n                           cacheDuration:0\n                                 success:successBlock\n                                 failure:failureBlock];\n    }\n}\n\n\n\n\n- (void)sendRequest:(NSString * _Nonnull)url\n         parameters:(id _Nullable)parameters\n      cacheDuration:(NSTimeInterval)cacheDuration\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock{\n    \n    if (parameters) {\n        \n         [self.requestEngine sendRequest:url\n                                  method:SJRequestMethodPOST\n                              parameters:parameters\n                               loadCache:NO\n                           cacheDuration:cacheDuration\n                                 success:successBlock\n                                 failure:failureBlock];\n        \n    }else{\n        \n        \n         [self.requestEngine sendRequest:url\n                                  method:SJRequestMethodGET\n                              parameters:nil\n                               loadCache:NO\n                           cacheDuration:cacheDuration\n                                 success:successBlock\n                                 failure:failureBlock];\n    }\n}\n\n\n\n\n- (void)sendRequest:(NSString * _Nonnull)url\n         parameters:(id _Nullable)parameters\n          loadCache:(BOOL)loadCache\n      cacheDuration:(NSTimeInterval)cacheDuration\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock{\n    \n    \n    if (parameters) {\n        \n         [self.requestEngine sendRequest:url\n                                  method:SJRequestMethodPOST\n                              parameters:parameters\n                               loadCache:loadCache\n                           cacheDuration:cacheDuration\n                                 success:successBlock\n                                 failure:failureBlock];\n    }else{\n        \n        \n         [self.requestEngine sendRequest:url\n                                  method:SJRequestMethodGET\n                              parameters:nil\n                               loadCache:loadCache\n                           cacheDuration:cacheDuration\n                                 success:successBlock\n                                 failure:failureBlock];\n    }\n}\n\n\n\n#pragma mark- ============== Request API using specific request method ==============\n\n- (void)sendRequest:(NSString * _Nonnull)url\n             method:(SJRequestMethod)method\n         parameters:(id _Nullable)parameters\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock{\n  \n     [self.requestEngine sendRequest:url\n                              method:method\n                          parameters:parameters\n                           loadCache:NO\n                       cacheDuration:0\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n- (void)sendRequest:(NSString * _Nonnull)url\n             method:(SJRequestMethod)method\n         parameters:(id _Nullable)parameters\n          loadCache:(BOOL)loadCache\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:method\n                          parameters:parameters\n                           loadCache:loadCache\n                       cacheDuration:0\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n- (void)sendRequest:(NSString * _Nonnull)url\n             method:(SJRequestMethod)method\n         parameters:(id _Nullable)parameters\n      cacheDuration:(NSTimeInterval)cacheDuration\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:method\n                          parameters:parameters\n                           loadCache:NO\n                       cacheDuration:cacheDuration\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n- (void)sendRequest:(NSString * _Nonnull)url\n             method:(SJRequestMethod)method\n         parameters:(id _Nullable)parameters\n          loadCache:(BOOL)loadCache\n      cacheDuration:(NSTimeInterval)cacheDuration\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock{\n    \n     [self.requestEngine sendRequest:url\n                              method:method\n                          parameters:parameters\n                           loadCache:loadCache\n                       cacheDuration:cacheDuration\n                             success:successBlock\n                             failure:failureBlock];\n}\n\n\n\n\n#pragma mark- ============== Request API uploading ==============\n\n\n- (void)sendUploadImageRequest:(NSString * _Nonnull)url\n                    parameters:(id _Nullable)parameters\n                         image:(UIImage * _Nonnull)image\n                          name:(NSString * _Nonnull)name\n                      mimeType:(NSString * _Nullable)mimeType\n                      progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                       success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                       failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock{\n    \n    \n     [self.uploadEngine sendUploadImagesRequest:url\n                                  ignoreBaseUrl:NO\n                                     parameters:parameters\n                                         images:@[image]\n                                  compressRatio:1\n                                           name:name\n                                       mimeType:mimeType\n                                       progress:uploadProgressBlock\n                                        success:uploadSuccessBlock\n                                        failure:uploadFailureBlock];\n}\n\n\n\n\n\n- (void)sendUploadImageRequest:(NSString * _Nonnull)url\n                 ignoreBaseUrl:(BOOL)ignoreBaseUrl\n                    parameters:(id _Nullable)parameters\n                         image:(UIImage * _Nonnull)image\n                          name:(NSString * _Nonnull)name\n                      mimeType:(NSString * _Nullable)mimeType\n                      progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                       success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                       failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock{\n\n    \n     [self.uploadEngine sendUploadImagesRequest:url\n                                  ignoreBaseUrl:ignoreBaseUrl\n                                     parameters:parameters\n                                         images:@[image]\n                                  compressRatio:1\n                                           name:name\n                                       mimeType:mimeType\n                                       progress:uploadProgressBlock\n                                        success:uploadSuccessBlock\n                                        failure:uploadFailureBlock];\n\n}\n\n\n\n\n- (void)sendUploadImagesRequest:(NSString * _Nonnull)url\n                     parameters:(id _Nullable)parameters\n                         images:(NSArray<UIImage *> * _Nonnull)images\n                           name:(NSString * _Nonnull)name\n                       mimeType:(NSString * _Nullable)mimeType\n                       progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                        success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                        failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock{\n    \n    \n     [self.uploadEngine sendUploadImagesRequest:url\n                                  ignoreBaseUrl:NO\n                                     parameters:parameters\n                                         images:images\n                                  compressRatio:1\n                                           name:name\n                                       mimeType:mimeType\n                                       progress:uploadProgressBlock\n                                        success:uploadSuccessBlock\n                                        failure:uploadFailureBlock];\n\n}\n\n\n\n\n- (void)sendUploadImagesRequest:(NSString * _Nonnull)url\n                  ignoreBaseUrl:(BOOL)ignoreBaseUrl\n                     parameters:(id _Nullable)parameters\n                         images:(NSArray<UIImage *> * _Nonnull)images\n                           name:(NSString * _Nonnull)name\n                       mimeType:(NSString * _Nullable)mimeType\n                       progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                        success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                        failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock{\n    \n    \n     [self.uploadEngine sendUploadImagesRequest:url\n                                  ignoreBaseUrl:ignoreBaseUrl\n                                     parameters:parameters\n                                         images:images\n                                  compressRatio:1\n                                           name:name\n                                       mimeType:mimeType\n                                       progress:uploadProgressBlock\n                                        success:uploadSuccessBlock\n                                        failure:uploadFailureBlock];\n \n}\n\n\n\n\n- (void)sendUploadImageRequest:(NSString * _Nonnull)url\n                    parameters:(id _Nullable)parameters\n                         image:(UIImage * _Nonnull)image\n                 compressRatio:(float)compressRatio\n                          name:(NSString * _Nonnull)name\n                      mimeType:(NSString * _Nullable)mimeType\n                      progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                       success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                       failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock{\n    \n     [self.uploadEngine sendUploadImagesRequest:url\n                                  ignoreBaseUrl:NO\n                                     parameters:parameters\n                                         images:@[image]\n                                  compressRatio:compressRatio\n                                           name:name\n                                       mimeType:mimeType\n                                       progress:uploadProgressBlock\n                                        success:uploadSuccessBlock\n                                        failure:uploadFailureBlock];\n    \n\n}\n\n\n\n\n- (void)sendUploadImageRequest:(NSString * _Nonnull)url\n                 ignoreBaseUrl:(BOOL)ignoreBaseUrl\n                    parameters:(id _Nullable)parameters\n                         image:(UIImage * _Nonnull)image\n                 compressRatio:(float)compressRatio\n                          name:(NSString * _Nonnull)name\n                      mimeType:(NSString * _Nullable)mimeType\n                      progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                       success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                       failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock{\n\n    \n     [self.uploadEngine sendUploadImagesRequest:url\n                                  ignoreBaseUrl:ignoreBaseUrl\n                                     parameters:parameters\n                                         images:@[image]\n                                  compressRatio:compressRatio\n                                           name:name\n                                       mimeType:mimeType\n                                       progress:uploadProgressBlock\n                                        success:uploadSuccessBlock\n                                        failure:uploadFailureBlock];\n}\n\n\n\n\n- (void)sendUploadImagesRequest:(NSString * _Nonnull)url\n                     parameters:(id _Nullable)parameters\n                         images:(NSArray<UIImage *> * _Nonnull)images\n                  compressRatio:(float)compressRatio\n                           name:(NSString * _Nonnull)name\n                       mimeType:(NSString * _Nullable)mimeType\n                       progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                        success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                        failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock{\n    \n     [self.uploadEngine sendUploadImagesRequest:url\n                                  ignoreBaseUrl:NO\n                                     parameters:parameters\n                                         images:images\n                                  compressRatio:compressRatio\n                                           name:name\n                                       mimeType:mimeType\n                                       progress:uploadProgressBlock\n                                        success:uploadSuccessBlock\n                                        failure:uploadFailureBlock];\n}\n\n\n\n\n- (void)sendUploadImagesRequest:(NSString * _Nonnull)url\n                  ignoreBaseUrl:(BOOL)ignoreBaseUrl\n                     parameters:(id _Nullable)parameters\n                         images:(NSArray<UIImage *> * _Nonnull)images\n                  compressRatio:(float)compressRatio\n                           name:(NSString * _Nonnull)name\n                       mimeType:(NSString * _Nullable)mimeType\n                       progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                        success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                        failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock{\n\n     [self.uploadEngine sendUploadImagesRequest:url\n                                  ignoreBaseUrl:ignoreBaseUrl\n                                     parameters:parameters\n                                         images:images\n                                  compressRatio:compressRatio\n                                           name:name\n                                       mimeType:mimeType\n                                       progress:uploadProgressBlock\n                                        success:uploadSuccessBlock\n                                        failure:uploadFailureBlock];\n}\n\n\n\n\n#pragma mark- ============== Request API downloading ==============\n\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock{\n    \n    \n     [self.downloadEngine sendDownloadRequest:url\n                                ignoreBaseUrl:NO\n                             downloadFilePath:downloadFilePath\n                                    resumable:YES\n                            backgroundSupport:NO\n                                     progress:downloadProgressBlock\n                                      success:downloadSuccessBlock\n                                      failure:downloadFailureBlock];\n}\n\n\n\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n              ignoreBaseUrl:(BOOL)ignoreBaseUrl\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock{\n    \n    \n     [self.downloadEngine sendDownloadRequest:url\n                                ignoreBaseUrl:ignoreBaseUrl\n                             downloadFilePath:downloadFilePath\n                                    resumable:YES\n                            backgroundSupport:NO\n                                     progress:downloadProgressBlock\n                                      success:downloadSuccessBlock\n                                      failure:downloadFailureBlock];\n    \n}\n\n\n\n\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                  resumable:(BOOL)resumable\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock{\n    \n    \n     [self.downloadEngine sendDownloadRequest:url\n                                ignoreBaseUrl:NO\n                             downloadFilePath:downloadFilePath\n                                    resumable:resumable\n                            backgroundSupport:NO\n                                     progress:downloadProgressBlock\n                                      success:downloadSuccessBlock\n                                      failure:downloadFailureBlock];\n}\n\n\n\n\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n              ignoreBaseUrl:(BOOL)ignoreBaseUrl\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                  resumable:(BOOL)resumable\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock{\n    \n    \n     [self.downloadEngine sendDownloadRequest:url\n                                ignoreBaseUrl:ignoreBaseUrl\n                             downloadFilePath:downloadFilePath\n                                    resumable:resumable\n                            backgroundSupport:NO\n                                     progress:downloadProgressBlock\n                                      success:downloadSuccessBlock\n                                      failure:downloadFailureBlock];\n}\n\n\n\n\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n          backgroundSupport:(BOOL)backgroundSupport\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock{\n    \n     [self.downloadEngine sendDownloadRequest:url\n                                ignoreBaseUrl:NO\n                             downloadFilePath:downloadFilePath\n                                    resumable:YES\n                            backgroundSupport:NO\n                                     progress:downloadProgressBlock\n                                      success:downloadSuccessBlock\n                                      failure:downloadFailureBlock];\n    \n}\n\n\n\n\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n              ignoreBaseUrl:(BOOL)ignoreBaseUrl\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n          backgroundSupport:(BOOL)backgroundSupport\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock{\n    \n     [self.downloadEngine sendDownloadRequest:url\n                                ignoreBaseUrl:ignoreBaseUrl\n                             downloadFilePath:downloadFilePath\n                                    resumable:YES\n                            backgroundSupport:NO\n                                     progress:downloadProgressBlock\n                                      success:downloadSuccessBlock\n                                      failure:downloadFailureBlock];\n    \n}\n\n\n\n\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                  resumable:(BOOL)resumable\n          backgroundSupport:(BOOL)backgroundSupport\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock{\n    \n    \n     [self.downloadEngine sendDownloadRequest:url\n                                ignoreBaseUrl:NO\n                             downloadFilePath:downloadFilePath\n                                    resumable:resumable\n                            backgroundSupport:backgroundSupport\n                                     progress:downloadProgressBlock\n                                      success:downloadSuccessBlock\n                                      failure:downloadFailureBlock];\n}\n\n\n\n\n\n- (void)sendDownloadRequest:(NSString * _Nonnull)url\n              ignoreBaseUrl:(BOOL)ignoreBaseUrl\n           downloadFilePath:(NSString *_Nonnull)downloadFilePath\n                  resumable:(BOOL)resumable\n          backgroundSupport:(BOOL)backgroundSupport\n                   progress:(SJDownloadProgressBlock _Nullable)downloadProgressBlock\n                    success:(SJDownloadSuccessBlock _Nullable)downloadSuccessBlock\n                    failure:(SJDownloadFailureBlock _Nullable)downloadFailureBlock{\n    \n    \n     [self.downloadEngine sendDownloadRequest:url\n                                ignoreBaseUrl:ignoreBaseUrl\n                             downloadFilePath:downloadFilePath\n                                    resumable:resumable\n                            backgroundSupport:backgroundSupport\n                                     progress:downloadProgressBlock\n                                      success:downloadSuccessBlock\n                                      failure:downloadFailureBlock];\n}\n\n\n\n#pragma mark- ============== Download suspend operation ==============\n\n- (void)suspendAllDownloadRequests{\n    \n     [self.downloadEngine suspendAllDownloadRequests];\n}\n\n\n\n\n- (void)suspendDownloadRequest:(NSString * _Nonnull)url{\n    \n     [self.downloadEngine suspendDownloadRequest:url];\n}\n\n\n\n\n- (void)suspendDownloadRequest:(NSString * _Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n     [self.downloadEngine suspendDownloadRequest:url ignoreBaseUrl:ignoreBaseUrl];\n}\n\n\n\n\n- (void)suspendDownloadRequests:(NSArray *_Nonnull)urls{\n    \n     [self.downloadEngine suspendDownloadRequests:urls];\n}\n\n\n\n\n- (void)suspendDownloadRequests:(NSArray *_Nonnull)urls ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n     [self.downloadEngine suspendDownloadRequests:urls ignoreBaseUrl:ignoreBaseUrl];\n}\n\n\n\n#pragma mark- ============== Download resume operation ==============\n\n- (void)resumeAllDownloadRequests{\n    \n     [self.downloadEngine resumeAllDownloadRequests];\n}\n\n\n\n- (void)resumeDownloadReqeust:(NSString *_Nonnull)url{\n    \n     [self.downloadEngine resumeDownloadReqeust:url];\n}\n\n\n\n\n- (void)resumeDownloadReqeust:(NSString *_Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n     [self.downloadEngine resumeDownloadReqeust:url ignoreBaseUrl:ignoreBaseUrl];\n}\n\n\n\n\n- (void)resumeDownloadReqeusts:(NSArray *_Nonnull)urls{\n    \n     [self.downloadEngine resumeDownloadReqeusts:urls];\n}\n\n\n\n\n- (void)resumeDownloadReqeusts:(NSArray *_Nonnull)urls ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n     [self.downloadEngine resumeDownloadReqeusts:urls ignoreBaseUrl:ignoreBaseUrl];\n}\n\n\n\n#pragma mark- ============== Download cancel operation ==============\n\n- (void)cancelAllDownloadRequests{\n    \n     [self.downloadEngine cancelAllDownloadRequests];\n}\n\n\n\n- (void)cancelDownloadRequest:(NSString * _Nonnull)url{\n    \n     [self.downloadEngine cancelDownloadRequest:url];\n    \n}\n\n\n\n- (void)cancelDownloadRequest:(NSString * _Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n     [self.downloadEngine cancelDownloadRequest:url ignoreBaseUrl:ignoreBaseUrl];\n}\n\n\n\n\n- (void)cancelDownloadRequests:(NSArray *_Nonnull)urls{\n    \n     [self.downloadEngine cancelDownloadRequests:urls];\n}\n\n\n\n\n- (void)cancelDownloadRequests:(NSArray *_Nonnull)urls ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n     [self.downloadEngine cancelDownloadRequests:urls ignoreBaseUrl:ignoreBaseUrl];\n}\n\n\n\n#pragma mark- ============== Download resume data ratio ==============\n\n- (CGFloat)resumeDataRatioOfRequest:(NSString *_Nonnull)url{\n    \n    return  [self.downloadEngine resumeDataRatioOfRequest:url];\n}\n\n\n\n- (CGFloat)resumeDataRatioOfRequest:(NSString *_Nonnull)url ignoreBaseUrl:(BOOL)ignoreBaseUrl{\n    \n    return  [self.downloadEngine resumeDataRatioOfRequest:url ignoreBaseUrl:ignoreBaseUrl];\n}\n\n\n#pragma mark- ============== Request Operation ==============\n\n- (void)cancelAllCurrentRequests{\n    \n    [self.requestPool cancelAllCurrentRequests];\n}\n\n\n\n\n- (void)cancelCurrentRequestWithUrl:(NSString *)url{\n    \n    [self.requestPool cancelCurrentRequestWithUrl:url];\n}\n\n\n\n\n\n- (void)cancelCurrentRequestWithUrl:(NSString * _Nonnull)url\n                             method:(NSString * _Nonnull)method\n                         parameters:(id _Nullable)parameters{\n    \n    [self.requestPool cancelCurrentRequestWithUrl:url\n                                           method:method\n                                       parameters:parameters];\n    \n}\n\n\n\n#pragma mark- ============== Request Info ==============\n\n- (void)logAllCurrentRequests{\n    \n    [self.requestPool logAllCurrentRequests];\n}\n\n\n\n\n- (BOOL)remainingCurrentRequests{\n    \n    return [self.requestPool remainingCurrentRequests];\n}\n\n\n\n\n- (NSInteger)currentRequestCount{\n    \n    return [self.requestPool currentRequestCount];\n}\n\n\n\n#pragma mark- ============== Cache Operations ==============\n\n\n#pragma mark Load cache\n\n\n- (void)loadCacheWithUrl:(NSString * _Nonnull)url completionBlock:(SJLoadCacheArrCompletionBlock _Nullable)completionBlock{\n    \n    [self.cacheManager loadCacheWithUrl:url completionBlock:completionBlock];\n}\n\n\n\n- (void)loadCacheWithUrl:(NSString * _Nonnull)url\n                  method:(NSString * _Nonnull)method\n         completionBlock:(SJLoadCacheArrCompletionBlock _Nullable)completionBlock{\n    \n    [self.cacheManager loadCacheWithUrl:url\n                                 method:method\n                        completionBlock:completionBlock];\n}\n\n\n\n- (void)loadCacheWithUrl:(NSString * _Nonnull)url\n                  method:(NSString * _Nonnull)method\n              parameters:(id _Nullable)parameters\n         completionBlock:(SJLoadCacheCompletionBlock _Nullable)completionBlock{\n    \n    [self.cacheManager loadCacheWithUrl:url\n                                 method:method\n                             parameters:parameters\n                        completionBlock:completionBlock];\n}\n\n\n\n#pragma mark calculate cache\n\n- (void)calculateCacheSizeCompletionBlock:(SJCalculateSizeCompletionBlock _Nullable)completionBlock{\n    \n    [self.cacheManager calculateAllCacheSizecompletionBlock:completionBlock];\n}\n\n\n\n#pragma mark clear cache\n\n- (void)clearAllCacheCompletionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock{\n    \n    [self.cacheManager clearAllCacheCompletionBlock:completionBlock];\n}\n\n\n\n\n- (void)clearCacheWithUrl:(NSString * _Nonnull)url completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock{\n    \n    [self.cacheManager clearCacheWithUrl:url completionBlock:completionBlock];\n}\n\n\n\n- (void)clearCacheWithUrl:(NSString * _Nonnull)url\n                   method:(NSString * _Nonnull)method\n          completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock{\n    \n    \n    [self.cacheManager clearCacheWithUrl:url\n                                  method:method\n                         completionBlock:completionBlock];\n    \n}\n\n\n\n- (void)clearCacheWithUrl:(NSString * _Nonnull)url\n                   method:(NSString * _Nonnull)method\n               parameters:(id _Nonnull)parameters\n          completionBlock:(SJClearCacheCompletionBlock _Nullable)completionBlock{\n    \n    [self.cacheManager clearCacheWithUrl:url\n                                  method:method\n                              parameters:parameters\n                         completionBlock:completionBlock];\n    \n}\n\n#pragma mark- Setter and Getter\n\n\n- (SJNetworkRequestPool *)requestPool{\n    \n    if (!_requestPool) {\n         _requestPool = [SJNetworkRequestPool sharedPool];\n    }\n    return _requestPool;\n}\n\n\n\n- (SJNetworkCacheManager *)cacheManager{\n    \n    if (!_cacheManager) {\n         _cacheManager = [SJNetworkCacheManager sharedManager];\n    }\n    return _cacheManager;\n}\n\n\n\n\n- (SJNetworkRequestEngine *)requestEngine{\n    \n    if (!_requestEngine) {\n         _requestEngine = [[SJNetworkRequestEngine alloc] init];\n    }\n    return _requestEngine;\n}\n\n\n\n\n- (SJNetworkUploadEngine *)uploadEngine{\n    \n    if (!_uploadEngine) {\n         _uploadEngine = [[SJNetworkUploadEngine alloc] init];\n    }\n    return _uploadEngine;\n}\n\n\n\n\n- (SJNetworkDownloadEngine *)downloadEngine{\n    \n    if (!_downloadEngine) {\n         _downloadEngine = [[SJNetworkDownloadEngine alloc] init];;\n    }\n    return _downloadEngine;\n}\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkProtocol.h",
    "content": "//\n//  SJNetworkProtocol.h\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/12/6.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n\n@class SJNetworkRequestModel;\n\n@protocol SJNetworkProtocol <NSObject>\n\n@required\n\n/**\n *  This method is used to deal with the request model when the corresponding request is finished\n *\n *  @param requestModel      request model of a network request\n *\n */\n- (void)handleRequesFinished:(SJNetworkRequestModel *)requestModel;\n\n\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkRequestEngine.h",
    "content": "//\n//  SJNetworkRequestManager.h\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/26.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n#import \"SJNetworkBaseEngine.h\"\n\n/* =============================\n *\n * SJNetworkRequestEngine\n *\n * SJNetworkRequestEngine is in charge of sending GET,POST,PUT or DELETE requests.\n *\n * =============================\n */\n\n\n@interface SJNetworkRequestEngine : SJNetworkBaseEngine\n\n\n\n/**\n *  This method offers the most number of parameters of a certain network request.\n *\n *\n *  @note:\n *\n *        1. SJRequestMethod:\n *\n *             a) If the method is set to be 'SJRequestMethodGET', then send GET request\n *             b) If the method is set to be 'SJRequestMethodPOST', then send POST request\n *             c) If the method is set to be 'SJRequestMethodPUT', then send PUT request\n *             d) If the method is set to be 'SJRequestMethodDELETE', then send DELETE request\n *\n *\n *        2. If 'loadCache' is set to be YES, then cache will be tried to\n *           load before sending network request no matter if the cache exists:\n *           If it exists, then load it and callback immediately.\n *           If it dose not exist,then send network request.\n *\n *           If 'loadCache' is set to be NO, then no matter if the cache\n *           exists, network request will be sent.\n *\n *\n *        3. If 'cacheDuration' is set to be large than 0,\n *           then the cache of this request will be written and\n *           the available duration of this cache will be equal to 'cacheDuration'.\n *\n *           So, if the past time is longer than the settled time duration,\n *           the network request will be sent.\n *\n *           If 'cacheDuration' is set to be less or equal to 0, then the cache\n *           of this request will not be written(The unit of cacheDuration is second).\n *\n *\n *\n *  @param url                request url\n *  @param method             request method\n *  @param parameters         parameters\n *  @param loadCache          consider whether to load cache\n *  @param cacheDuration      consider whether to write cache\n *  @param successBlock       success callback\n *  @param failureBlock       failure callback\n *\n */\n- (void)sendRequest:(NSString * _Nonnull)url\n             method:(SJRequestMethod)method\n         parameters:(id _Nullable)parameters\n          loadCache:(BOOL)loadCache\n      cacheDuration:(NSTimeInterval)cacheDuration\n            success:(SJSuccessBlock _Nullable)successBlock\n            failure:(SJFailureBlock _Nullable)failureBlock;\n\n\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkRequestEngine.m",
    "content": "//\n//  SJNetworkRequestManager.m\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/26.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"SJNetworkRequestEngine.h\"\n#import \"SJNetworkCacheManager.h\"\n#import \"SJNetworkRequestPool.h\"\n#import \"SJNetworkConfig.h\"\n#import \"SJNetworkUtils.h\"\n#import \"SJNetworkProtocol.h\"\n\n@interface SJNetworkRequestEngine()<SJNetworkProtocol>\n\n@property (nonatomic, strong) AFHTTPSessionManager *sessionManager;\n@property (nonatomic, strong) SJNetworkCacheManager *cacheManager;\n\n@end\n\n\n@implementation SJNetworkRequestEngine\n{\n    NSFileManager *_fileManager;\n    BOOL _isDebugMode;\n}\n\n\n#pragma mark- ============== Life Cycle Methods ==============\n\n\n- (instancetype)init{\n    \n    self = [super init];\n    if (self) {\n        \n        //file  manager\n        _fileManager = [NSFileManager defaultManager];\n        \n        //cachec manager\n        _cacheManager = [SJNetworkCacheManager sharedManager];\n        \n        //debug mode or not\n        _isDebugMode = [SJNetworkConfig sharedConfig].debugMode;\n        \n        //AFSessionManager config\n        _sessionManager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];\n        \n        //RequestSerializer\n        _sessionManager.requestSerializer = [AFJSONRequestSerializer serializer];\n        _sessionManager.requestSerializer.allowsCellularAccess = YES;\n        \n        _sessionManager.requestSerializer.timeoutInterval = [SJNetworkConfig sharedConfig].timeoutSeconds;\n        \n        //securityPolicy\n        _sessionManager.securityPolicy = [AFSecurityPolicy defaultPolicy];\n        [_sessionManager.securityPolicy setAllowInvalidCertificates:YES];\n        _sessionManager.securityPolicy.validatesDomainName = NO;\n        \n        //ResponseSerializer\n        _sessionManager.responseSerializer = [AFJSONResponseSerializer serializer];\n        _sessionManager.responseSerializer.acceptableContentTypes=[[NSSet alloc] initWithObjects:@\"application/xml\", @\"text/xml\",@\"text/html\", @\"application/json\",@\"text/plain\",nil];\n        \n        //Queue\n        _sessionManager.completionQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);\n        _sessionManager.operationQueue.maxConcurrentOperationCount = 5;\n        \n    }\n    return self;\n}\n\n\n#pragma mark- ============== Public Methods ==============\n\n\n- (void)sendRequest:(NSString *)url\n             method:(SJRequestMethod)method\n         parameters:(id)parameters\n          loadCache:(BOOL)loadCache\n      cacheDuration:(NSTimeInterval)cacheDuration\n            success:(SJSuccessBlock)successBlock\n            failure:(SJFailureBlock)failureBlock{\n    \n\n    //generate complete url string\n    NSString *completeUrlStr = [SJNetworkUtils generateCompleteRequestUrlStrWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                             requestUrlStr:url];\n    \n    \n    //request method\n    NSString *methodStr = [self p_methodStringFromRequestMethod:method];\n    \n    \n    //generate a unique identifer of a certain request\n    NSString *requestIdentifer = [SJNetworkUtils generateRequestIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                          requestUrlStr:url\n                                                                              methodStr:methodStr\n                                                                             parameters:parameters];\n    \n    \n    if (loadCache) {\n        \n        //if client wants to load cache\n        [_cacheManager loadCacheWithRequestIdentifer:requestIdentifer completionBlock:^(id  _Nullable cacheObject) {\n            \n            if (cacheObject) {\n                \n                dispatch_async(dispatch_get_main_queue(), ^{\n                    \n                    if(_isDebugMode){\n                        SJLog(@\"=========== Request succeed by loading Cache! \\n =========== Request url:%@\\n =========== Response object:%@\", completeUrlStr,cacheObject);\n                    }\n                    \n                    if (successBlock) {\n                        successBlock(cacheObject);\n                        return;\n                    }\n                });\n                \n                \n            }else{\n                \n                SJLog(@\"=========== Failed to load cache, start to sending network request...\");\n                [self p_sendRequestWithCompleteUrlStr:completeUrlStr\n                                               method:methodStr\n                                           parameters:parameters\n                                            loadCache:loadCache\n                                        cacheDuration:cacheDuration\n                                     requestIdentifer:requestIdentifer\n                                              success:successBlock\n                                              failure:failureBlock];\n                \n            }\n            \n        }];\n        \n    }else {\n        \n        SJLog(@\"=========== Do not need to load cache, start sending network request...\");\n        [self p_sendRequestWithCompleteUrlStr:completeUrlStr\n                                       method:methodStr\n                                   parameters:parameters\n                                    loadCache:loadCache\n                                cacheDuration:cacheDuration\n                             requestIdentifer:requestIdentifer\n                                      success:successBlock\n                                      failure:failureBlock];\n        \n    }\n}\n\n\n\n\n#pragma mark- ============== Private Methods ==============\n\n\n- (void)p_sendRequestWithCompleteUrlStr:(NSString *)completeUrlStr\n                                 method:(NSString *)methodStr\n                             parameters:(id)parameters\n                              loadCache:(BOOL)loadCache\n                          cacheDuration:(NSTimeInterval)cacheDuration\n                       requestIdentifer:(NSString *)requestIdentifer\n                                success:(SJSuccessBlock)successBlock\n                                failure:(SJFailureBlock)failureBlock{\n    \n    //add customed headers\n    [self addCustomHeaders];\n    \n    \n    //add default parameters\n    NSDictionary * completeParameters = [self addDefaultParametersWithCustomParameters:parameters];\n    \n    \n    //create corresponding request model\n    SJNetworkRequestModel *requestModel = [[SJNetworkRequestModel alloc] init];\n    requestModel.requestUrl = completeUrlStr;\n    requestModel.method = methodStr;\n    requestModel.parameters = completeParameters;\n    requestModel.loadCache = loadCache;\n    requestModel.cacheDuration = cacheDuration;\n    requestModel.requestIdentifer = requestIdentifer;\n    requestModel.successBlock = successBlock;\n    requestModel.failureBlock = failureBlock;\n    \n    \n    //create a session task corresponding to a request model\n    NSError * __autoreleasing requestSerializationError = nil;\n    NSURLSessionDataTask *dataTask = [self p_dataTaskWithRequestModel:requestModel\n                                                    requestSerializer:_sessionManager.requestSerializer\n                                                                error:&requestSerializationError];\n    \n    \n    //save task info request model\n    requestModel.task = dataTask;\n    \n    //save this request model into request set\n    [[SJNetworkRequestPool sharedPool] addRequestModel:requestModel];\n    \n    if (_isDebugMode) {\n        SJLog(@\"=========== Start requesting...\\n =========== url:%@\\n =========== method:%@\\n =========== parameters:%@\",completeUrlStr,methodStr,completeParameters);\n    }\n    \n    \n    //start request\n    [dataTask resume];\n    \n}\n\n\n\n- (NSURLSessionDataTask *)p_dataTaskWithRequestModel:(SJNetworkRequestModel *)requestModel\n                                 requestSerializer:(AFHTTPRequestSerializer *)requestSerializer\n                                             error:(NSError * _Nullable __autoreleasing *)error{\n    \n    //create request\n    NSMutableURLRequest *request = [requestSerializer requestWithMethod:requestModel.method\n                                                              URLString:requestModel.requestUrl\n                                                             parameters:requestModel.parameters\n                                                                  error:error];\n    \n\n  \n    //create data task\n    __weak __typeof(self) weakSelf = self;\n    NSURLSessionDataTask * dataTask = [_sessionManager dataTaskWithRequest:request\n                                                            uploadProgress:nil\n                                                          downloadProgress:nil\n                                                         completionHandler:^(NSURLResponse * _Nonnull response, id  _Nullable responseObject, NSError * _Nullable error){\n                                                \n                                      [weakSelf p_handleRequestModel:requestModel responseObject:responseObject error:error];\n                                  }];\n    \n    return dataTask;\n    \n}\n\n\n\n\n- (void)p_handleRequestModel:(SJNetworkRequestModel *)requestModel\n              responseObject:(id)responseObject\n                       error:(NSError *)error{\n    \n    NSError *requestError = nil;\n    BOOL requestSucceed = YES;\n    \n    //check request state\n    if (error) {\n        requestSucceed = NO;\n        requestError = error;\n    }\n    \n    if (requestSucceed) {\n        \n        //request succeed\n        requestModel.responseObject = responseObject;\n        [self requestDidSucceedWithRequestModel:requestModel];\n        \n    } else {\n        \n        //request failed\n        [self requestDidFailedWithRequestModel:requestModel error:requestError];\n    }\n    \n    dispatch_async(dispatch_get_main_queue(), ^{\n        \n        [self handleRequesFinished:requestModel];\n        \n    });\n    \n}\n\n\n\n\n- (NSString *)p_methodStringFromRequestMethod:(SJRequestMethod)method{\n    \n    switch (method) {\n            \n        case SJRequestMethodGET:{\n            return @\"GET\";\n        }\n            break;\n            \n        case SJRequestMethodPOST:{\n            return  @\"POST\";\n        }\n            break;\n            \n        case SJRequestMethodPUT:{\n            return  @\"PUT\";\n        }\n            break;\n            \n        case SJRequestMethodDELETE:{\n            return  @\"DELETE\";\n        }\n            break;\n    }\n}\n\n\n#pragma mark- ============== Override Methods ==============\n\n\n- (void)requestDidSucceedWithRequestModel:(SJNetworkRequestModel *)requestModel{\n    \n    //write cache\n    if (requestModel.cacheDuration > 0) {\n        \n        requestModel.responseData = [NSJSONSerialization dataWithJSONObject:requestModel.responseObject options:NSJSONWritingPrettyPrinted error:nil];\n        \n        if (requestModel.responseData) {\n            \n            [_cacheManager writeCacheWithReqeustModel:requestModel asynchronously:YES];\n            \n        }else{\n            SJLog(@\"=========== Failded to write cache, since something was wrong when transfering response data\");\n        }\n        \n        \n    }\n    \n    dispatch_async(dispatch_get_main_queue(), ^{\n        \n        if (_isDebugMode) {\n            SJLog(@\"=========== Request succeed! \\n =========== Request url:%@\\n =========== Response object:%@\", requestModel.requestUrl,requestModel.responseObject);\n        }\n        \n        if (requestModel.successBlock) {\n            requestModel.successBlock(requestModel.responseObject);\n        }\n    });\n    \n}\n\n\n- (void)requestDidFailedWithRequestModel:(SJNetworkRequestModel *)requestModel error:(NSError *)error{\n    \n    \n    dispatch_async(dispatch_get_main_queue(), ^{\n        \n        if (_isDebugMode) {\n            SJLog(@\"=========== Request failded! \\n =========== Request model:%@ \\n =========== NSError object:%@ \\n =========== Status code:%ld\",requestModel,error,(long)error.code);\n        }\n        \n        if (requestModel.failureBlock){\n            requestModel.failureBlock(requestModel.task, error, error.code);\n        }\n        \n    });\n}\n\n\n\n\n- (id)addDefaultParametersWithCustomParameters:(id)parameters{\n    \n    //if there is default parameters, then add them into custom parameters\n    id parameters_spliced = nil;\n    \n    if (parameters && [parameters isKindOfClass:[NSDictionary class]]) {\n        \n        if ([[[SJNetworkConfig sharedConfig].defailtParameters allKeys] count] > 0) {\n            \n            NSMutableDictionary *defaultParameters_m = [[SJNetworkConfig sharedConfig].defailtParameters mutableCopy];\n            [defaultParameters_m addEntriesFromDictionary:parameters];\n            parameters_spliced = [defaultParameters_m copy];\n            \n        }else{\n            \n            parameters_spliced = parameters;\n        }\n        \n    }else{\n        \n        parameters_spliced = [SJNetworkConfig sharedConfig].defailtParameters;\n        \n    }\n    \n    return parameters_spliced;\n}\n\n\n- (void)addCustomHeaders{\n    \n    //add custom header\n    NSDictionary *customHeaders = [SJNetworkConfig sharedConfig].customHeaders;\n    if ([customHeaders allKeys] > 0) {\n        \n        NSArray *allKeys = [customHeaders allKeys];\n        if ([allKeys count] >0) {\n            [customHeaders enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString *value, BOOL * _Nonnull stop) {\n                [_sessionManager.requestSerializer setValue:value forHTTPHeaderField:key];\n                if (_isDebugMode) {\n                    SJLog(@\"=========== added header:key:%@ value:%@\",key,value);\n                }\n            }];\n        }\n    }\n}\n\n\n\n#pragma mark- ============== SJNetworkProtocol ==============\n\n- (void)handleRequesFinished:(SJNetworkRequestModel *)requestModel{\n    \n    //clear all blocks\n    [requestModel clearAllBlocks];\n    \n    //remove this requst model from request queue\n    [[SJNetworkRequestPool sharedPool] removeRequestModel:requestModel];\n    \n}\n\n\n\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkRequestModel.h",
    "content": "//\n//  SJNetworkRequestModel.h\n//  SJNetwork\n//\n//  Created by Sun Shijie on 2017/8/17.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n#import <UIKit/UIKit.h>\n#import \"SJNetworkHeader.h\"\n\n\n@interface SJNetworkRequestModel : NSObject\n\n\n//Unique identifier of a request\n@property (nonatomic, readwrite, copy)   NSString *requestIdentifer;\n\n\n//Task of a request (NSURLSessionDataTask or NSURLSessionDownloadTask)\n@property (nonatomic, readwrite, strong) NSURLSessionTask *task;\n\n\n//NSHTTPURLResponse object\n@property (nonatomic, readwrite, strong) NSURLResponse *response;\n\n\n//Request url\n@property (nonatomic, readwrite, copy)   NSString *requestUrl;\n\n\n//If ignore baseUrl(which is set in SJNetworkConfig singleton instance)\n@property (nonatomic, readwrite, assign) BOOL ignoreBaseUrl;\n\n\n//Request method\n@property (nonatomic, readwrite, copy)   NSString *method;\n\n\n//Response object\n@property (nonatomic, readwrite, strong) id responseObject;\n\n\n\n//============== Only for ordinary request(GET,POST,PUT,DELETE) ==================//\n\n@property (nonatomic, readwrite, strong) id parameters;                             //parameters(request body)\n@property (nonatomic, readwrite, assign) BOOL loadCache;                            //if load cache(default is NO)\n@property (nonatomic, readwrite, assign) NSTimeInterval cacheDuration;              //if write cache(when bigger than 0, write cache;otherwise don't)\n@property (nonatomic, readwrite, strong) NSData *responseData;                      //response data of an ordinary request\n\n@property (nonatomic, readwrite, copy)   SJSuccessBlock successBlock;\n@property (nonatomic, readwrite, copy)   SJFailureBlock failureBlock;\n\n\n\n\n//============== Only for upload request ==================//\n\n@property (nonatomic, readwrite, copy)   NSString *uploadUrl;                        //target upload url\n@property (nonatomic, readwrite, copy)   NSArray<UIImage *> *uploadImages;           //upload images(or image)array\n@property (nonatomic, readwrite, copy)   NSString *imagesIdentifer;                  //identifier of upload image\n@property (nonatomic, readwrite, copy)   NSString *mimeType;                         //mime type of upload file\n@property (nonatomic, readwrite, assign) float imageCompressRatio;                   //compress ratio of all upload images, default is 1(original)\n@property (nonatomic, readonly, copy)    NSString *cacheDataFilePath;                //cache data file path\n@property (nonatomic, readonly, copy)    NSString *cacheDataInfoFilePath;            //cache data info file path(record info of corresponding cache data)\n\n\n@property (nonatomic, readwrite, copy)   SJUploadSuccessBlock uploadSuccessBlock;\n@property (nonatomic, readwrite, copy)   SJUploadProgressBlock uploadProgressBlock;\n@property (nonatomic, readwrite, copy)   SJUploadFailureBlock uploadFailedBlock;\n\n\n\n\n//============== Only for download request ==================//\n\n@property (nonatomic, readwrite, copy)   NSString *downloadFilePath;                  // target download file path\n@property (nonatomic, readwrite, assign) BOOL resumableDownload;                      // if support resumable download, default is YES\n@property (nonatomic, readwrite, assign) BOOL backgroundDownloadSupport;              // if support background download, default is NO\n@property (nonatomic, readwrite, strong) NSOutputStream *stream;                      // stream used to save download data\n@property (nonatomic, readwrite, assign) NSInteger totalLength;                       // total length of download file\n@property (nonatomic, readonly, copy)    NSString *resumeDataFilePath;                // resume data file path\n@property (nonatomic, readonly, copy)    NSString *resumeDataInfoFilePath;            // resume data info file path\n@property (nonatomic, readwrite, assign) SJDownloadManualOperation manualOperation;   // requst operation by user\n\n@property (nonatomic, readwrite, copy)   SJDownloadSuccessBlock downloadSuccessBlock;\n@property (nonatomic, readwrite, copy)   SJDownloadProgressBlock downloadProgressBlock;\n@property (nonatomic, readwrite, copy)   SJDownloadFailureBlock downloadFailureBlock;\n\n\n\n\n/**\n *  This method is used to return request type of this request\n *\n *  @return requestType               request type of this request\n */\n- (SJRequestType)requestType;\n\n\n\n/**\n *  This method is used to return the file path of cache data file\n *\n *  @return cacheDataFilePath         file path of cache data file\n */\n- (NSString *)cacheDataFilePath;\n\n\n\n\n/**\n *  This method is used to return the file path of cache info data file\n *\n *  @return cacheDataInfoFilePath     file path of cache info data file\n */\n- (NSString *)cacheDataInfoFilePath;\n\n\n\n\n/**\n *  This method is used to return the download resume data file path of this request （useful only if this is a download request）\n *\n *  @return resumeDataFilePath        file path of download resume data\n */\n- (NSString *)resumeDataFilePath;\n\n\n\n\n/**\n *  This method is used to return the download resume data info file path of this request（useful only if this is a download request）\n *\n *  @return resumeDataInfoFilePath    file path of download resume data info\n */\n- (NSString *)resumeDataInfoFilePath;\n\n\n\n\n/**\n *  This method is used to clear all callback blocks\n */\n- (void)clearAllBlocks;\n\n\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkRequestModel.m",
    "content": "//\n//  SJNetworkRequestModel.m\n//  SJNetwork\n//\n//  Created by Sun Shijie on 2017/8/17.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"SJNetworkRequestModel.h\"\n#import \"SJNetworkConfig.h\"\n#import \"SJNetworkUtils.h\"\n\n@interface SJNetworkRequestModel()\n\n@property (nonatomic, readwrite, copy) NSString *cacheDataFilePath;\n@property (nonatomic, readwrite, copy) NSString *cacheDataInfoFilePath;\n\n@property (nonatomic, readwrite, copy) NSString *resumeDataFilePath;\n@property (nonatomic, readwrite, copy) NSString *resumeDataInfoFilePath;\n\n@end\n\n\n@implementation SJNetworkRequestModel\n\n#pragma mark- ============== Public Methods ==============\n\n\n- (SJRequestType)requestType{\n    \n    if (self.downloadFilePath){\n        \n        return SJRequestTypeDownload;\n        \n    }else if(self.uploadUrl){\n        \n        return SJRequestTypeUpload;\n        \n    }else{\n        \n        return SJRequestTypeOrdinary;\n        \n    }\n}\n\n\n\n\n- (NSString *)cacheDataFilePath{\n    \n    if (self.requestType == SJRequestTypeOrdinary) {\n        \n        if (_cacheDataFilePath.length > 0) {\n            \n            return _cacheDataFilePath;\n            \n        }else{\n            \n            _cacheDataFilePath = [SJNetworkUtils cacheDataFilePathWithRequestIdentifer:_requestIdentifer];\n            return _cacheDataFilePath;\n        }\n        \n    }else{\n        \n        return nil;\n    }\n    \n}\n\n\n\n\n- (NSString *)cacheDataInfoFilePath{\n    \n    \n    if (self.requestType == SJRequestTypeOrdinary) {\n        \n        if (_cacheDataInfoFilePath.length > 0) {\n            \n            return _cacheDataInfoFilePath;\n            \n        }else{\n            \n            _cacheDataInfoFilePath = [SJNetworkUtils cacheDataInfoFilePathWithRequestIdentifer:_requestIdentifer];\n            return _cacheDataInfoFilePath;\n        }\n        \n    }else{\n        \n        return nil;\n    }\n    \n}\n\n\n\n\n\n- (NSString *)resumeDataFilePath{\n    \n    if (self.requestType == SJRequestTypeDownload) {\n        \n        if (_resumeDataFilePath.length > 0) {\n            \n            return _resumeDataFilePath;\n            \n        }else{\n            \n            _resumeDataFilePath = [SJNetworkUtils resumeDataFilePathWithRequestIdentifer:_requestIdentifer downloadFileName:_downloadFilePath.lastPathComponent];\n            return _resumeDataFilePath;\n        }\n        \n    }else{\n        \n        return nil;\n        \n    }\n}\n\n\n\n\n- (NSString *)resumeDataInfoFilePath{\n    \n    if (self.requestType == SJRequestTypeDownload) {\n        \n        if (_resumeDataInfoFilePath.length > 0) {\n            \n            return _resumeDataInfoFilePath;\n            \n        }else{\n            \n            _resumeDataInfoFilePath = [SJNetworkUtils resumeDataInfoFilePathWithRequestIdentifer:_requestIdentifer];\n            return _resumeDataInfoFilePath;\n        }\n        \n    }else{\n        \n        return nil;\n        \n    }\n    \n}\n\n\n\n\n\n- (void)clearAllBlocks{\n    \n    _successBlock = nil;\n    _failureBlock = nil;\n    \n    _uploadProgressBlock = nil;\n    _uploadSuccessBlock = nil;\n    _uploadFailedBlock = nil;\n    \n    _downloadProgressBlock = nil;\n    _downloadSuccessBlock = nil;\n    _downloadFailureBlock= nil;\n    \n}\n\n\n#pragma mark- ============== Override Methods ==============\n\n- (NSString *)description{\n    \n    if ([SJNetworkConfig sharedConfig].debugMode) {\n        \n        switch (self.requestType) {\n                \n            case SJRequestTypeOrdinary:\n                return [NSString stringWithFormat:@\"\\n{\\n   <%@: %p>\\n   type:            oridnary request\\n   method:          %@\\n   url:             %@\\n   parameters:      %@\\n   loadCache:       %@\\n   cacheDuration:   %@ seconds\\n   requestIdentifer:%@\\n   task:            %@\\n}\" ,NSStringFromClass([self class]),self,_method,_requestUrl,_parameters,_loadCache?@\"YES\":@\"NO\",[NSNumber numberWithInteger:_cacheDuration],_requestIdentifer,_task];\n                break;\n                \n            case SJRequestTypeUpload:\n                return [NSString stringWithFormat:@\"\\n{\\n   <%@: %p>\\n   type:            upload request\\n   method:          %@\\n   url:             %@\\n   parameters:      %@\\n   images:          %@\\n    requestIdentifer:%@\\n   task:            %@\\n}\" ,NSStringFromClass([self class]),self,_method,_requestUrl,_parameters,_uploadImages,_requestIdentifer,_task];\n                break;\n                \n            case SJRequestTypeDownload:\n                return [NSString stringWithFormat:@\"\\n{\\n   <%@: %p>\\n   type:            download request\\n   method:          %@\\n   url:             %@\\n   parameters:      %@\\n   target path:     %@\\n    requestIdentifer:%@\\n   task:            %@\\n}\" ,NSStringFromClass([self class]),self,_method,_requestUrl,_parameters,_downloadFilePath,_requestIdentifer,_task];\n                break;\n                \n            default:\n                [NSString stringWithFormat:@\"\\n  request type:unkown request type\\n  request object:%@\",self];\n                break;\n        }\n        \n        \n    }else{\n        \n         return [NSString stringWithFormat:@\"<%@: %p>\" ,NSStringFromClass([self class]),self];\n    }\n}\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkRequestPool.h",
    "content": "//\n//  SJNetworkRequestPool.h\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/25.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n\n\n@class SJNetworkRequestModel;\n\n\n/* =============================\n *\n * SJNetworkRequestPool\n *\n * SJNetworkRequestPool is in charge of managing current requests (holding request models,\n *  add or remove request models, cancel current requests etc)\n *\n * =============================\n */\n\n\n/**\n *  SJCurrentRequestModels: A dictionary which is used to hold all current request models\n */\ntypedef NSMutableDictionary<NSString *, SJNetworkRequestModel *> SJCurrentRequestModels;\n\n\n@interface SJNetworkRequestPool : NSObject\n\n\n//============================= Initialization =============================//\n\n\n/**\n *  SJNetworkRequestPool Singleton\n *\n *  @return SJNetworkRequestPool singleton instance\n */\n+ (SJNetworkRequestPool *_Nonnull)sharedPool;\n\n\n\n//============================= Requests Management =============================//\n\n/**\n *  This method is used to return all current request models\n *\n *  @return currentRequestModels    all current request models set(NSDictionary)\n */\n- (SJCurrentRequestModels *_Nonnull)currentRequestModels;\n\n\n\n\n/**\n *  This method is used to add a request model into current request models set\n */\n- (void)addRequestModel:(SJNetworkRequestModel *_Nonnull)requestModel;\n\n\n\n/**\n *  This method is used to remove a request model from current request models set\n */\n- (void)removeRequestModel:(SJNetworkRequestModel *_Nonnull)requestModel;\n\n\n\n\n/**\n *  This method is used to exchange a new request model with an old one\n */\n- (void)changeRequestModel:(SJNetworkRequestModel *_Nonnull)requestModel forKey:(NSString *_Nonnull)key;\n\n\n\n//============================= Requests Info =============================//\n\n\n\n/**\n *  This method is used to check if there is remaining curent request\n *\n *  @return if there is remaining requests\n */\n- (BOOL)remainingCurrentRequests;\n\n\n\n/**\n *  This method is used to calculate the count of current requests\n *\n *  @return the count of current requests\n */\n- (NSInteger)currentRequestCount;\n\n\n\n\n/**\n *  This method is used to log all current requests' information\n */\n- (void)logAllCurrentRequests;\n\n\n\n\n\n//============================= Cancel requests =============================//\n\n\n/**\n *  This method is used to cancel all current requests\n */\n- (void)cancelAllCurrentRequests;\n\n\n\n\n\n/**\n *  This method is used to cancel all current requests corresponding a reqeust url,\n *  no matter what the method is and parameters are\n *\n *  @param url              request url\n *\n */\n- (void)cancelCurrentRequestWithUrl:(NSString * _Nonnull)url;\n\n\n\n\n\n/**\n *  This method is used to cancel all current requests corresponding given reqeust urls,\n *  no matter what the method is and parameters are\n *\n *  @param urls              request url\n *\n */\n- (void)cancelCurrentRequestWithUrls:(NSArray * _Nonnull)urls;\n\n\n\n\n\n\n/**\n *  This method is used to cancel all current requests corresponding a specific reqeust url, method and parameters\n *\n *  @param url              request url\n *  @param method           request method\n *  @param parameters       parameters\n *\n */\n- (void)cancelCurrentRequestWithUrl:(NSString * _Nonnull)url\n                             method:(NSString * _Nonnull)method\n                         parameters:(id _Nullable)parameters;\n\n\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkRequestPool.m",
    "content": "//\n//  SJNetworkRequestPool.m\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/25.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"SJNetworkRequestPool.h\"\n#import \"SJNetworkUtils.h\"\n#import \"SJNetworkConfig.h\"\n#import \"SJNetworkRequestModel.h\"\n#import \"SJNetworkProtocol.h\"\n\n#import \"objc/runtime.h\"\n#import <CommonCrypto/CommonDigest.h>\n#import <pthread/pthread.h>\n\n\n#define Lock() pthread_mutex_lock(&_lock)\n#define Unlock() pthread_mutex_unlock(&_lock)\n\nstatic char currentRequestModelsKey;\n\n@interface SJNetworkRequestModel()<SJNetworkProtocol>\n\n@end\n\n@implementation SJNetworkRequestPool\n{\n    pthread_mutex_t _lock;\n    BOOL _isDebugMode;\n}\n\n\n#pragma mark- ============== Life Cycle ==============\n\n+ (SJNetworkRequestPool *)sharedPool {\n    \n    static SJNetworkRequestPool *sharedPool = NULL;\n    static dispatch_once_t onceToken;\n    \n    dispatch_once(&onceToken, ^{\n        sharedPool = [[SJNetworkRequestPool alloc] init];\n    });\n    return sharedPool;\n}\n\n\n\n- (instancetype)init {\n    \n    self = [super init];\n    if (self) {\n        \n        //lock\n        pthread_mutex_init(&_lock, NULL);\n        \n        //debug mode or not\n        _isDebugMode = [SJNetworkConfig sharedConfig].debugMode;\n        \n    }\n    return self;\n}\n\n#pragma mark- ============== Public Methods ==============\n\n- (SJCurrentRequestModels *)currentRequestModels {\n    \n    SJCurrentRequestModels *currentTasks = objc_getAssociatedObject(self, &currentRequestModelsKey);\n    if (currentTasks) {\n        return currentTasks;\n    }\n    currentTasks = [NSMutableDictionary dictionary];\n    objc_setAssociatedObject(self, &currentRequestModelsKey, currentTasks, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n    return currentTasks;\n}\n\n\n\n- (void)addRequestModel:(SJNetworkRequestModel *)requestModel{\n    \n    Lock();\n    [self.currentRequestModels setObject:requestModel forKey:[NSString stringWithFormat:@\"%ld\",(unsigned long)requestModel.task.taskIdentifier]];\n    Unlock();\n}\n\n\n\n- (void)removeRequestModel:(SJNetworkRequestModel *)requestModel{\n    \n    Lock();\n    [self.currentRequestModels removeObjectForKey:[NSString stringWithFormat:@\"%ld\",(unsigned long)requestModel.task.taskIdentifier]];\n    Unlock();\n    \n}\n\n\n\n- (void)changeRequestModel:(SJNetworkRequestModel *_Nonnull)requestModel forKey:(NSString *_Nonnull)key{\n    \n    Lock();\n    [self.currentRequestModels removeObjectForKey:key];\n    [self.currentRequestModels setObject:requestModel forKey:[NSString stringWithFormat:@\"%ld\",(unsigned long)requestModel.task.taskIdentifier]];\n    Unlock();\n    \n}\n\n\n\n- (BOOL)remainingCurrentRequests{\n    \n    NSArray *keys = [self.currentRequestModels  allKeys];\n    if ([keys count]>0) {\n        SJLog(@\"=========== There is remaining current request\");\n        return YES;\n    }\n    SJLog(@\"=========== There is no remaining current request\");\n    return NO;\n}\n\n\n\n\n- (NSInteger)currentRequestCount{\n    \n    if(![self remainingCurrentRequests]){\n        return 0;\n    }\n    \n    NSArray *keys = [self.currentRequestModels allKeys];\n    SJLog(@\"=========== There is %ld current requests\",(unsigned long)keys.count);\n    return [keys count];\n    \n}\n\n\n\n\n\n- (void)logAllCurrentRequests{\n    \n    if ([self remainingCurrentRequests]) {\n        \n        [self.currentRequestModels enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, SJNetworkRequestModel * _Nonnull requestModel, BOOL * _Nonnull stop) {\n            SJLog(@\"=========== Log current request:\\n %@\",requestModel);\n        }];\n        \n    }\n}\n\n\n\n\n\n- (void)cancelAllCurrentRequests{\n    \n    if ([self remainingCurrentRequests]) {\n        \n        for (SJNetworkRequestModel *requestModel in [self.currentRequestModels allValues]) {\n            \n        \n            if (requestModel.requestType == SJRequestTypeDownload) {\n                \n                if (requestModel.backgroundDownloadSupport) {\n                    \n                    NSURLSessionDownloadTask *downloadTask = (NSURLSessionDownloadTask*)requestModel.task;\n                    [downloadTask cancelByProducingResumeData:^(NSData * _Nullable resumeData) {\n                    }];\n                    \n                }else{\n                    \n                    [requestModel.task cancel];\n                }\n                \n            }else{\n                \n                [requestModel.task cancel];\n                [self removeRequestModel:requestModel];\n            }\n        }\n        SJLog(@\"=========== Canceled call current requests\");\n    }\n    \n    \n}\n\n\n\n\n\n- (void)cancelCurrentRequestWithUrl:(NSString * _Nonnull)url{\n    \n    if(![self remainingCurrentRequests]){\n        return;\n    }\n    \n    NSMutableArray *cancelRequestModelsArr = [NSMutableArray arrayWithCapacity:2];\n    NSString *requestIdentiferOfUrl =  [SJNetworkUtils generateMD5StringFromString: [NSString stringWithFormat:@\"Url:%@\",url]];\n    \n    [self.currentRequestModels enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, SJNetworkRequestModel * _Nonnull requestModel, BOOL * _Nonnull stop) {\n        \n        if ([requestModel.requestIdentifer containsString:requestIdentiferOfUrl]) {\n            [cancelRequestModelsArr addObject:requestModel];\n        }\n    }];\n    \n    if ([cancelRequestModelsArr count] == 0) {\n        \n        SJLog(@\"=========== There is no request to be canceled\");\n        \n    }else {\n        \n        if (_isDebugMode) {\n            SJLog(@\"=========== Requests to be canceled:\");\n            [cancelRequestModelsArr enumerateObjectsUsingBlock:^(SJNetworkRequestModel *requestModel, NSUInteger idx, BOOL * _Nonnull stop) {\n                SJLog(@\"=========== cancel request with url[%ld]:%@\",(unsigned long)idx,requestModel.requestUrl);\n            }];\n        }\n        \n        [cancelRequestModelsArr enumerateObjectsUsingBlock:^(SJNetworkRequestModel *requestModel, NSUInteger idx, BOOL * _Nonnull stop) {\n            \n            \n            if (requestModel.requestType == SJRequestTypeDownload) {\n                \n                if (requestModel.backgroundDownloadSupport) {\n                    NSURLSessionDownloadTask *downloadTask = (NSURLSessionDownloadTask*)requestModel.task;\n                    \n                    if (requestModel.task.state == NSURLSessionTaskStateCompleted) {\n                        \n                        SJLog(@\"=========== Canceled background support download request:%@\",requestModel);\n                        NSError *error = [NSError errorWithDomain:@\"Request has been canceled\" code:0 userInfo:nil];\n                        \n                        dispatch_async(dispatch_get_main_queue(), ^{\n                            \n                            if (requestModel.downloadFailureBlock) {\n                                requestModel.downloadFailureBlock(requestModel.task, error,requestModel.resumeDataFilePath);\n                            }\n                            [self handleRequesFinished:requestModel];\n                        });\n                        \n                    }else{\n                        \n                        [downloadTask cancelByProducingResumeData:^(NSData * _Nullable resumeData) {\n                            \n                        }];\n                        SJLog(@\"=========== Background support download request %@ has been canceled\",requestModel);\n                    }\n                    \n                }else{\n                    \n                    [requestModel.task cancel];\n                    SJLog(@\"=========== Request %@ has been canceled\",requestModel);\n                }\n                \n            }else{\n                \n                [requestModel.task cancel];\n                SJLog(@\"=========== Request %@ has been canceled\",requestModel);\n                if (requestModel.requestType != SJRequestTypeDownload) {\n                    [self removeRequestModel:requestModel];\n                }\n            }\n        }];\n        \n        SJLog(@\"=========== All requests with request url : '%@' are canceled\",url);\n    }\n    \n    \n}\n\n\n\n\n- (void)cancelCurrentRequestWithUrls:(NSArray * _Nonnull)urls{\n    \n    if ([urls count] == 0) {\n        SJLog(@\"=========== There is no input urls!\");\n        return;\n    }\n    \n    if(![self remainingCurrentRequests]){\n        return;\n    }\n    \n    [urls enumerateObjectsUsingBlock:^(NSString *url, NSUInteger idx, BOOL * _Nonnull stop) {\n        [self cancelCurrentRequestWithUrl:url];\n    }];\n}\n\n\n\n\n\n\n- (void)cancelCurrentRequestWithUrl:(NSString * _Nonnull)url\n                             method:(NSString * _Nonnull)method\n                         parameters:(id _Nullable)parameter{\n    \n    if(![self remainingCurrentRequests]){\n        return;\n    }\n    \n    NSString *requestIdentifier = [SJNetworkUtils generateRequestIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                           requestUrlStr:url\n                                                                               methodStr:method\n                                                                              parameters:parameter];\n    \n    [self p_cancelRequestWithRequestIdentifier:requestIdentifier];\n}\n\n\n\n#pragma mark- ============== Private Methods ==============\n\n- (void)p_cancelRequestWithRequestIdentifier:(NSString *)requestIdentifier{\n    \n    [self.currentRequestModels enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, SJNetworkRequestModel * _Nonnull requestModel, BOOL * _Nonnull stop) {\n        \n        if ([requestModel.requestIdentifer isEqualToString:requestIdentifier]) {\n            \n            if (requestModel.task) {\n                \n                [requestModel.task cancel];\n                SJLog(@\"=========== Canceled request:%@\",requestModel);\n                if (requestModel.requestType != SJRequestTypeDownload) {\n                    [self removeRequestModel:requestModel];\n                }\n                \n            }else {\n                SJLog(@\"=========== There is no task of this request\");\n            }\n        }\n    }];\n}\n\n\n\n\n#pragma mark- ============== SJNetworkProtocol ==============\n\n- (void)handleRequesFinished:(SJNetworkRequestModel *)requestModel{\n    \n    //clear all blocks\n    [requestModel clearAllBlocks];\n    \n    //remove this requst model from request queue\n    [[SJNetworkRequestPool sharedPool] removeRequestModel:requestModel];\n    \n}\n\n\n\n\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkUploadEngine.h",
    "content": "//\n//  SJNetworkUploadManager.h\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/26.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n#import \"SJNetworkBaseEngine.h\"\n\n\n/* =============================\n *\n * SJNetworkUploadEngine\n *\n * SJNetworkUploadEngine is in charge of upload image or images.\n *\n * =============================\n */\n\n\n@interface SJNetworkUploadEngine : SJNetworkBaseEngine\n\n\n//========================= Request API upload images ==========================//\n\n\n/**\n *  This method offers the most number of parameters of a certain upload request.\n *\n *  @note:\n *        1. All the other upload image API will call this method.\n *\n *        2. If 'ignoreBaseUrl' is set to be YES, the base url which is holden by\n *           SJNetworkConfig will be ignored, so the 'url' will be the complete request\n *           url of this request.(default is set to be NO)\n *\n *        3. 'name' is the name of image(or images). When uploading more than one\n *           image, a new unique name of one single image will be generated in method\n *           implementation.\n *\n *  @param url                   request url\n *  @param ignoreBaseUrl         consider whether to ignore configured base url\n *  @param parameters            parameters\n *  @param images                UIImage object array\n *  @param compressRatio         compress ratio of images\n *  @param name                  file name\n *  @param mimeType              file type\n *  @param uploadProgressBlock   upload progress callback\n *  @param uploadSuccessBlock    upload success callback\n *  @param uploadFailureBlock    upload failure callback\n *\n */\n- (void)sendUploadImagesRequest:(NSString * _Nonnull)url\n                  ignoreBaseUrl:(BOOL)ignoreBaseUrl\n                     parameters:(id _Nullable)parameters\n                         images:(NSArray<UIImage *> * _Nonnull)images\n                  compressRatio:(float)compressRatio\n                           name:(NSString * _Nonnull)name\n                       mimeType:(NSString * _Nullable)mimeType\n                       progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                        success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                        failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock;\n\n\n\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkUploadEngine.m",
    "content": "//\n//  SJNetworkUploadManager.m\n//  SJNetworkingDemo\n//\n//  Created by Sun Shijie on 2017/11/26.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"SJNetworkUploadEngine.h\"\n#import \"SJNetworkRequestPool.h\"\n#import \"SJNetworkConfig.h\"\n#import \"SJNetworkUtils.h\"\n#import \"SJNetworkProtocol.h\"\n\n@interface SJNetworkUploadEngine()<SJNetworkProtocol>\n\n@property (nonatomic, strong) AFHTTPSessionManager *sessionManager;\n\n@end\n\n@implementation SJNetworkUploadEngine\n{\n     BOOL _isDebugMode;\n}\n\n#pragma mark- ============== Life Cycle ==============\n\n\n- (instancetype)init{\n    \n    self = [super init];\n    if (self) {\n        \n        //debug mode or not\n        _isDebugMode = [SJNetworkConfig sharedConfig].debugMode;\n        \n        //AFSessionManager config\n        _sessionManager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];\n        \n        //RequestSerializer\n        _sessionManager.requestSerializer = [AFJSONRequestSerializer serializer];\n        _sessionManager.requestSerializer.allowsCellularAccess = YES;\n        \n        _sessionManager.requestSerializer.timeoutInterval = [SJNetworkConfig sharedConfig].timeoutSeconds;\n        \n\n        //securityPolicy\n        _sessionManager.securityPolicy = [AFSecurityPolicy defaultPolicy];\n        [_sessionManager.securityPolicy setAllowInvalidCertificates:YES];\n        _sessionManager.securityPolicy.validatesDomainName = NO;\n        \n        //ResponseSerializer\n        _sessionManager.responseSerializer = [AFJSONResponseSerializer serializer];\n        _sessionManager.responseSerializer.acceptableContentTypes=[[NSSet alloc] initWithObjects:@\"application/xml\", @\"text/xml\",@\"text/html\", @\"application/json\",@\"text/plain\",nil];\n        \n        //Queue\n        _sessionManager.completionQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);\n        _sessionManager.operationQueue.maxConcurrentOperationCount = 5;\n        \n        \n    }\n    return self;\n}\n\n\n#pragma mark- ============== Public Methods ==============\n\n- (void)sendUploadImagesRequest:(NSString * _Nonnull)url\n                  ignoreBaseUrl:(BOOL)ignoreBaseUrl\n                     parameters:(id _Nullable)parameters\n                         images:(NSArray<UIImage *> * _Nonnull)images\n                  compressRatio:(float)compressRatio\n                           name:(NSString * _Nonnull)name\n                       mimeType:(NSString * _Nullable)mimeType\n                       progress:(SJUploadProgressBlock _Nullable)uploadProgressBlock\n                        success:(SJUploadSuccessBlock _Nullable)uploadSuccessBlock\n                        failure:(SJUploadFailureBlock _Nullable)uploadFailureBlock{\n    \n    //if images count equals 0, then return\n    if ([images count] == 0) {\n        SJLog(@\"=========== Upload image failed:There is no image to upload!\");\n        return;\n    }\n\n    \n    //default method is POST\n    NSString *methodStr = @\"POST\";\n    \n    //generate full request url\n    NSString *completeUrlStr = nil;\n    \n    //generate a unique identifer of a spectific request\n    NSString *requestIdentifer = nil;\n    \n    if (ignoreBaseUrl) {\n        \n        completeUrlStr   = url;\n        requestIdentifer = [SJNetworkUtils generateRequestIdentiferWithBaseUrlStr:nil\n                                                                   requestUrlStr:url\n                                                                       methodStr:methodStr\n                                                                      parameters:parameters];\n    }else{\n        \n        completeUrlStr   = [[SJNetworkConfig sharedConfig].baseUrl stringByAppendingPathComponent:url];\n        requestIdentifer = [SJNetworkUtils generateRequestIdentiferWithBaseUrlStr:[SJNetworkConfig sharedConfig].baseUrl\n                                                                   requestUrlStr:url\n                                                                       methodStr:methodStr\n                                                                      parameters:parameters];\n    }\n    \n    //add custom headers\n    [self addCustomHeaders];\n    \n    //add default parameters\n    NSDictionary * completeParameters = [self addDefaultParametersWithCustomParameters:parameters];\n    \n    //create corresponding request model and send request with it\n    SJNetworkRequestModel *requestModel = [[SJNetworkRequestModel alloc] init];\n    requestModel.requestUrl = completeUrlStr;\n    requestModel.uploadUrl = url;\n    requestModel.method = methodStr;\n    requestModel.parameters = completeParameters;\n    requestModel.uploadImages = images;\n    requestModel.imageCompressRatio = compressRatio;\n    requestModel.imagesIdentifer = name;\n    requestModel.mimeType = mimeType;\n    requestModel.requestIdentifer = requestIdentifer;\n    requestModel.uploadSuccessBlock = uploadSuccessBlock;\n    requestModel.uploadProgressBlock = uploadProgressBlock;\n    requestModel.uploadFailedBlock = uploadFailureBlock;\n    \n    [self p_sendUploadImagesRequestWithRequestModel:requestModel];\n}\n\n\n\n#pragma mark- ============== Private Methods ==============\n\n- (void)p_sendUploadImagesRequestWithRequestModel:(SJNetworkRequestModel *)requestModel{\n    \n    \n    if (_isDebugMode) {\n        SJLog(@\"=========== Start upload request with url:%@...\",requestModel.requestUrl);\n    }\n    \n    __weak __typeof(self) weakSelf = self;\n    NSURLSessionDataTask *uploadTask = [_sessionManager POST:requestModel.requestUrl\n                                                  parameters:requestModel.parameters\n                                   constructingBodyWithBlock:^(id<AFMultipartFormData>  _Nonnull formData) {\n                                       \n                                       [requestModel.uploadImages enumerateObjectsUsingBlock:^(UIImage * _Nonnull image, NSUInteger idx, BOOL * _Nonnull stop) {\n                                           \n                                           //image compress ratio\n                                           float ratio = requestModel.imageCompressRatio;\n                                           if (ratio > 1 || ratio < 0) {\n                                               ratio = 1;\n                                           }\n                                           \n                                           //image data\n                                           NSData *imageData = nil;\n                                           \n                                           //image type\n                                           NSString *imageType = nil;\n                                           \n                                           if ([requestModel.mimeType isEqualToString:@\"png\"] || [requestModel.mimeType isEqualToString:@\"PNG\"]  ) {\n                                               \n                                               imageData = UIImagePNGRepresentation(image);\n                                               imageType = @\"png\";\n                                               \n                                           }else if ([requestModel.mimeType isEqualToString:@\"jpg\"] || [requestModel.mimeType isEqualToString:@\"JPG\"] ){\n                                               \n                                               imageData = UIImageJPEGRepresentation(image, ratio);\n                                               imageType = @\"jpg\";\n                                               \n                                           }else if ([requestModel.mimeType isEqualToString:@\"jpeg\"] || [requestModel.mimeType isEqualToString:@\"JPEG\"] ){\n                                               \n                                               imageData = UIImageJPEGRepresentation(image, ratio);\n                                               imageType = @\"jpeg\";\n                                               \n                                           }else{\n                                               imageData = UIImageJPEGRepresentation(image, ratio);\n                                               imageType = @\"jpg\";\n                                           }\n                                           \n                                                                                      \n                                           long index = idx;\n                                           NSTimeInterval interval = [[NSDate date] timeIntervalSince1970];\n                                           long long totalMilliseconds = interval * 1000;\n                                           \n                                           //file name should be unique\n                                           NSString *fileName = [NSString stringWithFormat:@\"%lld.%@\", totalMilliseconds,imageType];\n                                           \n                                           //name should be unique\n                                           NSString *identifer = [NSString stringWithFormat:@\"%@%ld\", requestModel.imagesIdentifer, index];\n                                           \n                                           \n                                           [formData appendPartWithFileData:imageData\n                                                                       name:identifer\n                                                                   fileName:fileName\n                                                                   mimeType:[NSString stringWithFormat:@\"image/%@\",imageType]];\n                                       }];\n                                       \n                                   } progress:^(NSProgress * _Nonnull uploadProgress) {\n                                       \n                                       if (_isDebugMode){\n                                           SJLog(@\"=========== Upload image progress:%@\",uploadProgress);\n                                       }\n                                       \n                                       dispatch_async(dispatch_get_main_queue(), ^{\n                                         if (requestModel.uploadProgressBlock) {\n                                             requestModel.uploadProgressBlock(uploadProgress);\n                                         }\n                                           \n                                       });\n                                       \n                                   } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {\n                                       \n                                       if (_isDebugMode){\n                                          SJLog(@\"=========== Upload image request succeed:%@\\n =========== Successfully uploaded images:%@\",responseObject,requestModel.uploadImages);\n                                       }\n                                           \n                                       dispatch_async(dispatch_get_main_queue(), ^{\n                                           \n                                         if (requestModel.uploadSuccessBlock) {                                             \n                                             requestModel.uploadSuccessBlock(responseObject);\n                                         }\n                                           \n                                         [weakSelf handleRequesFinished:requestModel];\n                                           \n                                       });\n                                       \n                                       \n                                   } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {\n                                       \n                                       \n                                       if (_isDebugMode){\n                                           SJLog(@\"=========== Upload images request failed: \\n =========== error:%@\\n =========== status code:%ld\\n =========== failed images:%@:\",error,(long)error.code,requestModel.uploadImages);\n                                       }\n                                       \n                                        dispatch_async(dispatch_get_main_queue(), ^{\n                                            \n                                           if (requestModel.uploadFailedBlock) {\n                                               requestModel.uploadFailedBlock(task, error,error.code,requestModel.uploadImages);\n                                            }\n                                           [weakSelf handleRequesFinished:requestModel];\n                                            \n                                        });\n                                      \n                                   }];\n    \n    requestModel.task = uploadTask;\n    [[SJNetworkRequestPool sharedPool] addRequestModel:requestModel];\n\n}\n\n\n\n\n#pragma mark- ============== Override Methods ==============\n\n- (id)addDefaultParametersWithCustomParameters:(id)parameters{\n    \n    //if there is default parameters, then add them into custom parameters\n    id parameters_spliced = nil;\n    \n    if (parameters && [parameters isKindOfClass:[NSDictionary class]]) {\n        \n        if ([[[SJNetworkConfig sharedConfig].defailtParameters allKeys] count] > 0) {\n            \n            NSMutableDictionary *defaultParameters_m = [[SJNetworkConfig sharedConfig].defailtParameters mutableCopy];\n            [defaultParameters_m addEntriesFromDictionary:parameters];\n            parameters_spliced = [defaultParameters_m copy];\n            \n        }else{\n            \n            parameters_spliced = parameters;\n        }\n        \n    }else{\n        \n        parameters_spliced = [SJNetworkConfig sharedConfig].defailtParameters;\n        \n    }\n    \n    return parameters_spliced;\n}\n\n\n\n- (void)addCustomHeaders{\n    \n    //add custom header\n    NSDictionary *customHeaders = [SJNetworkConfig sharedConfig].customHeaders;\n    if ([customHeaders allKeys] > 0) {\n        NSArray *allKeys = [customHeaders allKeys];\n        if ([allKeys count] >0) {\n            [customHeaders enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString *value, BOOL * _Nonnull stop) {\n                [_sessionManager.requestSerializer setValue:value forHTTPHeaderField:key];\n                if (_isDebugMode) {\n                  SJLog(@\"=========== added header:key:%@ value:%@\",key,value);\n                }\n            }];\n        }\n    }\n}\n\n\n\n#pragma mark- ============== SJNetworkProtocol ==============\n\n- (void)handleRequesFinished:(SJNetworkRequestModel *)requestModel{\n    \n    //clear all blocks\n    [requestModel clearAllBlocks];\n    \n    //remove this requst model from request queue\n    [[SJNetworkRequestPool sharedPool] removeRequestModel:requestModel];\n}\n\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkUtils.h",
    "content": "//\n//  SJNetworkUtils.h\n//  SJNetwork\n//\n//  Created by Sun Shijie on 2017/8/17.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n\n\n/* =============================\n *\n * SJNetworkUtils\n *\n * SJNetworkUtils is in charge of some operation of string or generate information\n *\n * =============================\n */\n\nextern NSString * _Nonnull const SJNetworkCacheBaseFolderName;\nextern NSString * _Nonnull const SJNetworkCacheFileSuffix;\nextern NSString * _Nonnull const SJNetworkCacheInfoFileSuffix;\nextern NSString * _Nonnull const SJNetworkDownloadResumeDataInfoFileSuffix;\n\n\n@interface SJNetworkUtils : NSObject\n\n\n/**\n *  This method is used to return app version\n *\n *  @return app version string\n */\n+ (NSString * _Nullable)appVersionStr;\n\n\n\n/**\n *  This method is used to generate the md5 string of given string\n *\n *  @param string                       original string\n *\n *  @return the transformed md5 string\n */\n+ (NSString * _Nonnull)generateMD5StringFromString:(NSString *_Nonnull)string;\n\n\n\n\n/**\n *  This method is used to generate complete request url\n *\n *  @param baseUrlStr                   base url\n *  @param requestUrlStr                request url\n *\n *  @return the complete request url\n */\n+ (NSString *_Nonnull)generateCompleteRequestUrlStrWithBaseUrlStr:(NSString *_Nonnull)baseUrlStr requestUrlStr:(NSString *_Nonnull)requestUrlStr;\n\n\n\n\n\n/**\n *  This method is used to generate partial identifier of more than one request\n *\n *  @param baseUrlStr                   base url\n *  @param requestUrlStr                request url\n *  @param methodStr                       request method\n *\n *  @return the unique identifier  of a specific request\n */\n+ (NSString *_Nonnull)generatePartialIdentiferWithBaseUrlStr:(NSString * _Nonnull)baseUrlStr\n                                               requestUrlStr:(NSString * _Nullable)requestUrlStr\n                                                   methodStr:(NSString * _Nullable)methodStr;\n\n\n\n\n\n/**\n *  This method is used to generate unique identifier of a specific request\n *\n *  @param baseUrlStr                   base url\n *  @param requestUrlStr                request url\n *  @param methodStr                    request method\n *  @param parameters                   parameters (can be nil)\n *\n *  @return the unique identifier  of a specific request\n */\n+ (NSString *_Nonnull)generateRequestIdentiferWithBaseUrlStr:(NSString * _Nullable)baseUrlStr\n                                               requestUrlStr:(NSString * _Nullable)requestUrlStr\n                                                   methodStr:(NSString * _Nullable)methodStr\n                                                  parameters:(id _Nullable)parameters;\n\n\n\n/**\n *  This method is used to generate unique identifier of a download request\n *\n *  @param baseUrlStr                   base url\n *  @param requestUrlStr                request url\n *\n *  @return the unique identifier of a download request\n */\n+ (NSString * _Nonnull)generateDownloadRequestIdentiferWithBaseUrlStr:(NSString * _Nullable)baseUrlStr requestUrlStr:(NSString * _Nonnull)requestUrlStr;\n\n\n\n\n/**\n *  This method is used to create a folder of a given folder name\n *\n *  @param folderName                   folder name\n *\n *  @return the full path of the new folder\n */\n+ (NSString * _Nonnull)createBasePathWithFolderName:(NSString * _Nonnull)folderName;\n\n\n\n\n\n/**\n *  This method is used to create cache base folder path\n *\n *\n *  @return the base cache  folder path\n */\n+ (NSString * _Nonnull)createCacheBasePath;\n\n\n\n\n/**\n *  This method is used to return the cache data file path of the given requestIdentifer\n *\n *  @param requestIdentifer     the unique identier of a specific  network request\n *\n *  @return the cache data file path\n */\n+ (NSString * _Nonnull)cacheDataFilePathWithRequestIdentifer:(NSString * _Nonnull)requestIdentifer;\n\n\n\n\n\n/**\n *  This method is used to return the cache data file path of the given requestIdentifer\n *\n *  @param requestIdentifer     the unique identier of a specific  network request\n *\n *  @return the cache data file path\n */\n+ (NSString * _Nonnull)cacheDataInfoFilePathWithRequestIdentifer:(NSString * _Nonnull)requestIdentifer;\n\n\n\n\n\n/**\n *  This method is used to return resume data file path of the given requestIdentifer\n *\n *  @param requestIdentifer     the unique identier of a specific  network request\n *  @param downloadFileName     the download file name (the last path component of a complete download request url)\n *\n *  @return resume data file path\n */\n+ (NSString * _Nonnull)resumeDataFilePathWithRequestIdentifer:(NSString * _Nonnull)requestIdentifer downloadFileName:(NSString * _Nonnull)downloadFileName;\n\n\n\n\n/**\n *  This method is used to return the resume data info file path of the given requestIdentifer\n *\n *  @param requestIdentifer     the unique identier of a specific  network request\n *\n *  @return the resume data info file path\n */\n+ (NSString * _Nonnull)resumeDataInfoFilePathWithRequestIdentifer:(NSString * _Nonnull)requestIdentifer;\n\n\n\n\n/**\n *  This method is used to check the availability of given data\n *\n *  @param data                 NSData object (can be a cache data of cache info data etc.)\n *\n *  @return the availability of a given data\n */\n+ (BOOL)availabilityOfData:(NSData * _Nonnull)data;\n\n\n\n\n\n/**\n *  This method is used to generate image file type string of a certain image data\n *\n *  @param imageData            image data\n *\n *  @return image file type\n */\n+ (NSString * _Nullable)imageFileTypeForImageData:(NSData * _Nonnull)imageData;\n\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/SJNetwork/SJNetworkUtils.m",
    "content": "//\n//  SJNetworkUtils.m\n//  SJNetwork\n//\n//  Created by Sun Shijie on 2017/8/17.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"SJNetworkUtils.h\"\n#import <CommonCrypto/CommonDigest.h>\n\n\n#define CC_MD5_DIGEST_LENGTH    16          /* digest length in bytes */\n#define CC_MD5_BLOCK_BYTES      64          /* block size in bytes */\n#define CC_MD5_BLOCK_LONG       (CC_MD5_BLOCK_BYTES / sizeof(CC_LONG))\n\n\n\nNSString * const SJNetworkCacheBaseFolderName = @\"SJNetworkCache\";\nNSString * const SJNetworkCacheFileSuffix = @\"cacheData\";\nNSString * const SJNetworkCacheInfoFileSuffix = @\"cacheInfo\";\nNSString * const SJNetworkDownloadResumeDataInfoFileSuffix = @\"resumeInfo\";\n\n\n@implementation SJNetworkUtils\n\n\n#pragma mark- ============== Public Methods ==============\n\n\n\n+ (NSString * _Nullable)appVersionStr{\n    \n    return [[[NSBundle mainBundle] infoDictionary] objectForKey:@\"CFBundleShortVersionString\"];\n}\n\n\n+ (NSString * _Nonnull)generateMD5StringFromString:(NSString * _Nonnull)string {\n    \n    NSParameterAssert(string != nil && [string length] > 0);\n    \n    const char *value = [string UTF8String];\n    \n    unsigned char outputBuffer[CC_MD5_DIGEST_LENGTH];\n    CC_MD5(value, (CC_LONG)strlen(value), outputBuffer);\n    \n    NSMutableString *outputString = [[NSMutableString alloc] initWithCapacity:CC_MD5_DIGEST_LENGTH * 2];\n    for(NSInteger count = 0; count < CC_MD5_DIGEST_LENGTH; count++){\n        [outputString appendFormat:@\"%02x\",outputBuffer[count]];\n    }\n    \n    return outputString;\n}\n\n\n+ (NSString * _Nonnull)generateCompleteRequestUrlStrWithBaseUrlStr:(NSString * _Nonnull)baseUrlStr requestUrlStr:(NSString * _Nonnull)requestUrlStr{\n    \n    NSURL *requestUrl = [NSURL URLWithString:requestUrlStr];\n    \n    if (requestUrl && requestUrl.host && requestUrl.scheme) {\n        return requestUrlStr;\n    }\n    \n    NSURL *url = [NSURL URLWithString:baseUrlStr];\n    \n    if (baseUrlStr.length > 0 && ![baseUrlStr hasSuffix:@\"/\"]) {\n        url = [url URLByAppendingPathComponent:@\"\"];\n    }\n    \n    return [NSURL URLWithString:requestUrlStr relativeToURL:url].absoluteString;\n    \n}\n\n\n+ (NSString *_Nonnull)generatePartialIdentiferWithBaseUrlStr:(NSString * _Nonnull)baseUrlStr\n                                               requestUrlStr:(NSString * _Nullable)requestUrlStr\n                                                   methodStr:(NSString * _Nullable)methodStr{\n    \n    NSString *url_md5 =           nil;\n    NSString *method_md5 =        nil;\n    NSString *partialIdentifier = nil;\n    \n    NSString *host_md5 =         [self generateMD5StringFromString: [NSString stringWithFormat:@\"Host:%@\",baseUrlStr]];\n    \n    if (requestUrlStr.length == 0 && methodStr.length == 0) {\n        \n        partialIdentifier = [NSString stringWithFormat:@\"%@\",host_md5];\n        \n    }else if (requestUrlStr.length > 0 && methodStr.length == 0) {\n        \n        url_md5 =          [self generateMD5StringFromString: [NSString stringWithFormat:@\"Url:%@\",requestUrlStr]];\n        partialIdentifier = [NSString stringWithFormat:@\"%@_%@\",host_md5,url_md5];\n        \n    }else if (requestUrlStr.length > 0 && methodStr.length > 0){\n        \n        url_md5 =          [self generateMD5StringFromString: [NSString stringWithFormat:@\"Url:%@\",requestUrlStr]];\n        method_md5 =          [self generateMD5StringFromString: [NSString stringWithFormat:@\"Method:%@\",methodStr]];\n        partialIdentifier = [NSString stringWithFormat:@\"%@_%@_%@\",host_md5,url_md5,method_md5];\n        \n    }\n    \n    return partialIdentifier;\n}\n\n\n+ (NSString * _Nonnull)generateRequestIdentiferWithBaseUrlStr:(NSString * _Nullable)baseUrlStr\n                                                requestUrlStr:(NSString * _Nullable)requestUrlStr\n                                                    methodStr:(NSString * _Nullable)methodStr\n                                                   parameters:(id _Nullable)parameters{\n    \n    NSString *host_md5 =         [self generateMD5StringFromString: [NSString stringWithFormat:@\"Host:%@\",baseUrlStr]];\n    NSString *url_md5 =          [self generateMD5StringFromString: [NSString stringWithFormat:@\"Url:%@\",requestUrlStr]];\n    NSString *method_md5 =       [self generateMD5StringFromString: [NSString stringWithFormat:@\"Method:%@\",methodStr]];\n    \n    NSString *paramsStr = @\"\";\n    NSString *parameters_md5 = @\"\";\n    \n    if (parameters) {\n        paramsStr =        [self p_convertJsonStringFromDictionaryOrArray:parameters];\n        parameters_md5 =   [self generateMD5StringFromString: [NSString stringWithFormat:@\"Parameters:%@\",paramsStr]];\n    }\n    \n    NSString *requestIdentifer = [NSString stringWithFormat:@\"%@_%@_%@_%@\",host_md5,url_md5,method_md5,parameters_md5];\n    \n    return requestIdentifer;\n    \n}\n\n\n+ (NSString * _Nonnull)generateDownloadRequestIdentiferWithBaseUrlStr:(NSString * _Nullable)baseUrlStr requestUrlStr:(NSString * _Nonnull)requestUrlStr{\n\n    NSString *host_md5 =         [self generateMD5StringFromString: [NSString stringWithFormat:@\"Host:%@\",baseUrlStr]];\n    NSString *url_md5 =          [self generateMD5StringFromString: [NSString stringWithFormat:@\"Url:%@\",requestUrlStr]];\n\n    NSString *requestIdentifer = [NSString stringWithFormat:@\"%@_%@_\",host_md5,url_md5];\n\n    return requestIdentifer;\n\n}\n\n\n\n+ (NSString * _Nonnull)createBasePathWithFolderName:(NSString * _Nonnull)folderName{\n    \n    NSString *pathOfCache = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0];\n    NSString *path = [pathOfCache stringByAppendingPathComponent:folderName];\n    [self p_createDirectoryIfNeeded:path];\n    return path;\n    \n}\n\n\n\n\n+ (NSString * _Nonnull)createCacheBasePath{\n    \n    return [self createBasePathWithFolderName:SJNetworkCacheBaseFolderName];\n}\n\n\n\n\n+ (NSString * _Nonnull)cacheDataFilePathWithRequestIdentifer:(NSString * _Nonnull)requestIdentifer{\n    \n    if (requestIdentifer.length > 0) {\n        \n        NSString *cacheFileName = [NSString stringWithFormat:@\"%@.%@\", requestIdentifer,SJNetworkCacheFileSuffix];\n        NSString *cacheFilePath = [[self createCacheBasePath] stringByAppendingPathComponent:cacheFileName];\n        return cacheFilePath;\n        \n    }else{\n        \n        return nil;\n        \n    }\n}\n\n\n\n\n+ (NSString * _Nonnull)cacheDataInfoFilePathWithRequestIdentifer:(NSString * _Nonnull)requestIdentifer{\n    \n    if (requestIdentifer.length > 0) {\n        \n        NSString *cacheInfoFileName = [NSString stringWithFormat:@\"%@.%@\", requestIdentifer,SJNetworkCacheInfoFileSuffix];\n        NSString *cacheInfoFilePath = [[self createCacheBasePath] stringByAppendingPathComponent:cacheInfoFileName];\n        return cacheInfoFilePath;\n        \n    }else{\n        \n        return nil;\n        \n    }\n    \n}\n\n\n\n\n+ (NSString * _Nonnull)resumeDataFilePathWithRequestIdentifer:(NSString * _Nonnull)requestIdentifer downloadFileName:(NSString * _Nonnull)downloadFileName{\n    \n    NSString *dataFileName = [NSString stringWithFormat:@\"%@.%@\", requestIdentifer, downloadFileName];\n    NSString * resumeDataFilePath = [[self createCacheBasePath] stringByAppendingPathComponent:dataFileName];\n    return resumeDataFilePath;\n}\n\n\n\n\n\n+ (NSString * _Nonnull)resumeDataInfoFilePathWithRequestIdentifer:(NSString * _Nonnull)requestIdentifer{\n    \n    NSString * dataInfoFileName = [NSString stringWithFormat:@\"%@.%@\", requestIdentifer,SJNetworkDownloadResumeDataInfoFileSuffix];\n    NSString * resumeDataInfoFilePath = [[self createCacheBasePath] stringByAppendingPathComponent:dataInfoFileName];\n    return resumeDataInfoFilePath;\n}\n\n\n\n\n+ (BOOL)availabilityOfData:(NSData * _Nonnull)data{\n    \n    if (!data || [data length] < 1) return NO;\n    \n    NSError *error;\n    NSDictionary *resumeDictionary = [NSPropertyListSerialization propertyListWithData:data options:NSPropertyListImmutable format:NULL error:&error];\n    \n    if (!resumeDictionary || error) return NO;\n    \n    // Before iOS 9 & Mac OS X 10.11\n#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED < 90000)\\\n|| (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED < 101100)\n    NSString *localFilePath = [resumeDictionary objectForKey:@\"NSURLSessionResumeInfoLocalPath\"];\n    if ([localFilePath length] < 1) return NO;\n    return [[NSFileManager defaultManager] fileExistsAtPath:localFilePath];\n#endif\n    return YES;\n}\n\n\n+ (NSString * _Nullable)imageFileTypeForImageData:(NSData * _Nonnull)imageData{\n    \n    uint8_t c;\n    [imageData getBytes:&c length:1];\n    switch (c) {\n        case 0xFF:\n            return @\"jpeg\";\n        case 0x89:\n            return @\"png\";\n        case 0x47:\n            return @\"gif\";\n        case 0x49:\n        case 0x4D:\n            return @\"tiff\";\n        case 0x52:\n            if ([imageData length] < 12) {\n                return nil;\n            }\n            NSString *testString = [[NSString alloc] initWithData:[imageData subdataWithRange:NSMakeRange(0, 12)] encoding:NSASCIIStringEncoding];\n            if ([testString hasPrefix:@\"RIFF\"] && [testString hasSuffix:@\"WEBP\"]) {\n                return @\"webp\";\n            }\n            return nil;\n    }\n    return nil;\n}\n\n#pragma mark- ============== Private Methods ==============\n\n\n+ (NSString *)p_convertJsonStringFromDictionaryOrArray:(id)parameter {\n    \n    NSData *data = [NSJSONSerialization dataWithJSONObject:parameter\n                                                   options:NSJSONWritingPrettyPrinted\n                                                     error:nil];\n    \n    NSString *jsonStr = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];\n    return jsonStr;\n}\n\n\n\n\n+ (void)p_createDirectoryIfNeeded:(NSString *)path {\n    \n    NSFileManager *fileManager = [NSFileManager defaultManager];\n    BOOL isDir;\n    \n    if (![fileManager fileExistsAtPath:path isDirectory:&isDir]) {\n        \n        [self p_createBaseDirectoryAtPath:path];\n        \n    } else {\n        \n        if (!isDir) {\n            \n            NSError *error = nil;\n            [fileManager removeItemAtPath:path error:&error];\n            [self p_createBaseDirectoryAtPath:path];\n        }\n    }\n}\n\n\n\n\n+ (void)p_createBaseDirectoryAtPath:(NSString *)path {\n\n    [[NSFileManager defaultManager] createDirectoryAtPath:path\n                              withIntermediateDirectories:YES\n                                               attributes:nil\n                                                    error:nil];\n}\n\n\n\n\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/ViewController/DownLoadViewController.h",
    "content": "//\n//  DownLoadViewController.h\n//  WWNetwork\n//\n//  Created by Sun Shijie on 2017/9/9.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\n@interface DownLoadViewController : UIViewController\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/ViewController/DownLoadViewController.m",
    "content": "//\n//  DownLoadViewController.m\n//  WWNetwork\n//\n//  Created by Sun Shijie on 2017/9/9.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"DownLoadViewController.h\"\n#import \"SJNetwork.h\"\n\n@interface DownLoadViewController ()\n\n@property (weak, nonatomic) IBOutlet UIProgressView *progress_resumable;\n@property (weak, nonatomic) IBOutlet UIProgressView *progress_none_resumable;\n@property (weak, nonatomic) IBOutlet UIProgressView *progress_resumable_background;\n@property (weak, nonatomic) IBOutlet UIProgressView *progress_none_resumable_background;\n\n\n@end\n\n@implementation DownLoadViewController\n{\n    NSString *_imagesFolder;\n}\n\n- (void)viewDidLoad {\n    \n    [super viewDidLoad];\n\n\n    //images folder\n    _imagesFolder = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];\n}\n\n\n- (void)viewWillAppear:(BOOL)animated{\n    \n    [super viewWillAppear:animated];\n    \n     [SJNetworkConfig sharedConfig].baseUrl = @\"http://oih3a9o4n.bkt.clouddn.com\";\n    \n    \n    self.progress_resumable.progress = [[SJNetworkManager sharedManager] resumeDataRatioOfRequest:@\"wallpaper.jpg\"];\n    \n    self.progress_none_resumable.progress = [[SJNetworkManager sharedManager] resumeDataRatioOfRequest:@\"half-eatch.jpg\"];\n    \n    self.progress_resumable_background.progress = [[SJNetworkManager sharedManager] resumeDataRatioOfRequest:@\"universe.jpg\"];\n    \n    self.progress_none_resumable_background.progress = [[SJNetworkManager sharedManager] resumeDataRatioOfRequest:@\"iceberg.jpg\"];\n}\n\n\n#pragma mark- resumable && none background download support\n\n- (IBAction)startResumableDownload:(UIButton *)sender {\n\n    [self p_download1];\n}\n\n- (IBAction)suspendResumableDownload:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] suspendDownloadRequest:@\"wallpaper.jpg\"];\n}\n\n- (IBAction)restartResumableDownload:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] resumeDownloadReqeust:@\"wallpaper.jpg\"];\n}\n\n- (IBAction)cancelResumableDownload:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] cancelCurrentRequestWithUrl:@\"wallpaper.jpg\"];\n}\n\n\n\n#pragma mark- none resumable && none background download support\n\n- (IBAction)startNoneResumableDownload:(UIButton *)sender {\n\n   [self p_download2];\n}\n\n- (IBAction)suspendNoneResumableDownload:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] suspendDownloadRequest:@\"half-eatch.jpg\"];\n}\n\n- (IBAction)restartNoneResumableDownload:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] resumeDownloadReqeust:@\"half-eatch.jpg\"];\n}\n\n\n- (IBAction)cancelNoneResumableDownload:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] cancelCurrentRequestWithUrl:@\"half-eatch.jpg\"];\n}\n\n\n\n#pragma mark- resumable && background download support\n\n- (IBAction)startResumableBackgroundDownload:(UIButton *)sender {\n\n    [self p_download3];\n    \n}\n- (IBAction)suspendResumableBackgroundDownload:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] suspendDownloadRequest:@\"universe.jpg\"];\n}\n\n- (IBAction)restartResumableBackgroundDownload:(UIButton *)sender {\n    \n     [[SJNetworkManager sharedManager] resumeDownloadReqeust:@\"universe.jpg\"];\n}\n\n\n- (IBAction)cancelResumableBackgroundDownload:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] cancelCurrentRequestWithUrl:@\"universe.jpg\"];\n}\n\n\n#pragma mark- none resumable && background download support\n\n- (IBAction)startNoneResumableBackgroundDownload:(UIButton *)sender {\n    \n    [self p_download4];\n}\n\n\n- (IBAction)suspendNoneResumableBackgroundDownload:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] suspendDownloadRequest:@\"iceberg.jpg\"];\n}\n\n\n- (IBAction)restartNoneResumableBackgroundDownload:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] resumeDownloadReqeust:@\"iceberg.jpg\"];\n}\n\n- (IBAction)cancelNoneResumableBackgroundDownload:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] cancelDownloadRequest:@\"iceberg.jpg\"];\n}\n\n\n#pragma mark- all current download requests operation\n\n- (IBAction)suspendAllDownloadRequests:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] suspendAllDownloadRequests];\n}\n\n\n- (IBAction)resumeAllDownloadRequests:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] resumeAllDownloadRequests];\n}\n\n- (IBAction)cancelAllDownloadRequests:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] cancelAllDownloadRequests];\n}\n\n\n- (IBAction)logAllCurrentRequests:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] logAllCurrentRequests];\n}\n\n\n- (void)p_download1{\n    \n    //resumable && none background download support\n    [[SJNetworkManager sharedManager] sendDownloadRequest:@\"wallpaper.jpg\"\n                                         downloadFilePath:_imagesFolder\n                                                 progress:^(NSInteger receivedSize, NSInteger expectedSize, CGFloat progress)\n    {\n          self.progress_resumable.progress = progress;\n                                                     \n    } success:^(id responseObject) {\n                                                     \n          NSLog(@\"Download succeed!\");\n                                                     \n    } failure:^(NSURLSessionTask *task, NSError *error, NSString *resumableDataPath) {\n                                                     \n          NSLog(@\"Download failed!\");\n                                                     \n    }];\n}\n\n- (void)p_download2{\n    \n    //none resumable && none background download support\n    [[SJNetworkManager sharedManager] sendDownloadRequest:@\"half-eatch.jpg\"\n                                         downloadFilePath:[_imagesFolder stringByAppendingPathComponent:@\"half-eatch.jpg\"]\n                                                resumable:NO\n                                        backgroundSupport:NO\n                                                 progress:^(NSInteger receivedSize, NSInteger expectedSize, CGFloat progress)\n    {\n                                                     \n        self.progress_none_resumable.progress = progress;\n                                                     \n    } success:^(id responseObject) {\n        \n        NSLog(@\"Download succeed!\");\n        \n    } failure:^(NSURLSessionTask *task, NSError *error, NSString *resumableDataPath) {\n     \n        NSLog(@\"Download failed!\");\n    }];\n}\n\n\n- (void)p_download3{\n    \n    //resumable &&  background download support\n    [[SJNetworkManager sharedManager] sendDownloadRequest:@\"universe.jpg\"\n                                         downloadFilePath:[_imagesFolder stringByAppendingPathComponent:@\"universe.jpg\"]\n                                                resumable:YES\n                                        backgroundSupport:YES\n                                                 progress:^(NSInteger receivedSize, NSInteger expectedSize, CGFloat progress)\n    {\n                                                     \n        self.progress_resumable_background.progress = progress;\n                                                     \n    } success:^(id responseObject) {\n        \n         NSLog(@\"Download succeed!\");\n        \n    } failure:^(NSURLSessionTask *task, NSError *error, NSString *resumableDataPath) {\n        \n         NSLog(@\"Download failed!\");\n        \n    }];\n}\n\n- (void)p_download4{\n    \n    //none resumable &&  background download support\n    [[SJNetworkManager sharedManager] sendDownloadRequest:@\"iceberg.jpg\"\n                                         downloadFilePath:[_imagesFolder stringByAppendingPathComponent:@\"iceberg.jpg\"]\n                                                resumable:NO\n                                        backgroundSupport:YES\n                                                 progress:^(NSInteger receivedSize, NSInteger expectedSize, CGFloat progress)\n    {\n                                                     \n        self.progress_none_resumable_background.progress = progress;\n                                                     \n     } success:^(id response) {\n         \n         NSLog(@\"Download succeed!\");\n         \n     } failure:^(NSURLSessionTask *task, NSError *error, NSString *resumableDataPath) {\n         \n          NSLog(@\"Download failed!\");\n         \n     }];\n    \n}\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/ViewController/UploadViewController.h",
    "content": "//\n//  UploadViewController.h\n//  SJNetwork\n//\n//  Created by Sun Shijie on 2017/9/9.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\n@interface UploadViewController : UIViewController\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/ViewController/UploadViewController.m",
    "content": "//\n//  UploadViewController.m\n//  SJNetwork\n//\n//  Created by Sun Shijie on 2017/9/9.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"UploadViewController.h\"\n#import \"SJNetwork.h\"\n\n@interface UploadViewController ()\n\n@property (weak, nonatomic) IBOutlet UIProgressView *uploadOneImageProgress;\n\n@property (weak, nonatomic) IBOutlet UIProgressView *uploadTwoImageProgress;\n\n\n@end\n\n@implementation UploadViewController\n\n- (void)viewDidLoad {\n    [super viewDidLoad];\n    // Do any additional setup after loading the view.\n    self.uploadOneImageProgress.observedProgress = [NSProgress progressWithTotalUnitCount:0];\n    self.uploadTwoImageProgress.observedProgress = [NSProgress progressWithTotalUnitCount:0];\n    \n}\n\n\n- (void)viewWillAppear:(BOOL)animated{\n    \n    [super viewWillAppear:animated];\n    \n    [SJNetworkConfig sharedConfig].baseUrl = @\"http://uploads.im\";\n}\n\n- (IBAction)uploadOneImage:(UIButton *)sender {\n\n    UIImage *image = [UIImage imageNamed:@\"image_2.jpg\"];\n    \n    //====================== with baseurl==================//\n    \n    [[SJNetworkManager sharedManager]  sendUploadImageRequest:@\"api\"\n                                                   parameters:nil\n                                                        image:image\n                                                compressRatio:0.5\n                                                         name:@\"color\"\n                                                     mimeType:@\"jpg\"\n                                                     progress:^(NSProgress *uploadProgress) {\n                                                         \n        self.uploadOneImageProgress.observedProgress = uploadProgress;\n                                                         \n    } success:^(id response) {\n                                                         \n        NSLog(@\"upload succeed\");\n                                                         \n    } failure:^(NSURLSessionTask *task, NSError *error, NSInteger statusCode, NSArray<UIImage *> *uploadFailedImages) {\n                                                         \n        NSLog(@\"upload failed\");\n        \n    }];\n    \n}\n\n\n- (IBAction)resetOneProgressView:(UIButton *)sender {\n    \n    self.uploadOneImageProgress.observedProgress = [NSProgress progressWithTotalUnitCount:0];\n}\n\n\n- (IBAction)uploadTwoImages:(UIButton *)sender {\n    \n     UIImage *image_3 = [UIImage imageNamed:@\"image_3\"];\n     UIImage *image_4 = [UIImage imageNamed:@\"image_4\"];\n    \n    \n     [[SJNetworkManager sharedManager] sendUploadImagesRequest:@\"http://uploads.im/api\"\n                                                 ignoreBaseUrl:YES\n                                                    parameters:nil\n                                                        images:@[image_3,image_4]\n                                                 compressRatio:0.5\n                                                          name:@\"images\"\n                                                      mimeType:@\"png\"\n                                                      progress:^(NSProgress *uploadProgress) {\n\n        self.uploadTwoImageProgress.observedProgress = uploadProgress;\n\n    } success:^(id response) {\n        \n        NSLog(@\"upload succeed\");\n\n    } failure:^(NSURLSessionTask *task, NSError *error, NSInteger statusCode, NSArray<UIImage *> *uploadFailedImages) {\n        \n        NSLog(@\"upload failed, failed images:%@\",uploadFailedImages);\n    }];\n    \n\n    \n}\n\n- (IBAction)resetTwoProgressView:(UIButton *)sender {\n    self.uploadTwoImageProgress.observedProgress = [NSProgress progressWithTotalUnitCount:0];\n}\n\n\n\n- (IBAction)cancelProgress1Requst:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] cancelCurrentRequestWithUrl:@\"api\"];\n}\n\n\n\n- (IBAction)cancelProgress2Request:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] cancelCurrentRequestWithUrl:@\"http://uploads.im/api\"];\n}\n\n\n\n- (IBAction)cancelAllRequests:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] cancelAllCurrentRequests];\n}\n\n\n\n- (IBAction)logAllCurrentRequest:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] logAllCurrentRequests];\n}\n\n\n\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/ViewController/ViewController.h",
    "content": "//\n//  ViewController.h\n//  SJNetwork\n//\n//  Created by Sun Shijie on 2017/8/16.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\n@interface ViewController : UIViewController\n\n\n@end\n\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo/ViewController/ViewController.m",
    "content": "//\n//  ViewController.m\n//  SJNetwork\n//\n//  Created by Sun Shijie on 2017/8/16.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import \"ViewController.h\"\n#import \"SJNetwork.h\"\n\n@interface ViewController ()\n\n@end\n\n@implementation ViewController\n{\n    NSString * _url0;\n    NSString * _url1;\n    NSString * _url2;\n    \n    NSDictionary *_params_0;\n    NSDictionary *_params_1;\n    NSDictionary *_params_2;\n\n}\n\n- (void)viewDidLoad {\n    [super viewDidLoad];\n}\n\n- (void)viewWillAppear:(BOOL)animated{\n    \n    [super viewWillAppear:animated];\n    \n    [SJNetworkConfig sharedConfig].baseUrl = @\"http://v.juhe.cn\";\n    \n    //for request0\n    _url0 = @\"toutiao/index\";\n    _params_0 = @{@\"key\":@\"0c604536ac4f8c45fb4b90178bab9285\",@\"type\":@\"keji\"};\n    \n    \n    //for request1\n    _url1 = @\"toutiao/index\";\n    _params_1 = @{@\"key\":@\"0c604536ac4f8c45fb4b90178bab9285\",@\"type\":@\"top\"};\n    \n    \n    //for request2\n    _url2 = @\"weixin/query\";\n    _params_2 = @{@\"key\":@\"d57d833a635f34ac809b61390369e4da\"};\n}\n\n\n- (IBAction)sendRequest_1_not_load_cache:(UIButton *)sender {\n    \n    \n    [[SJNetworkManager sharedManager] sendPostRequest:_url1\n                                           parameters:_params_1\n                                              success:^(id responseObject) {\n        \n        NSLog(@\"request succeed:%@\",responseObject);\n                                                  \n    } failure:^(NSURLSessionTask *task, NSError *error, NSInteger statusCode) {\n        \n        NSLog(@\"request failed:%@\",error);\n    }];\n    \n\n\n}\n\n\n\n- (IBAction)sendRequest_1_save_cache:(UIButton *)sender {\n    \n\n    [[SJNetworkManager sharedManager] sendGetRequest:_url1\n                                          parameters:_params_1\n                                       cacheDuration:5\n                                             success:^(id responseObject) {\n                                                 \n        NSLog(@\"request succeed:%@\",responseObject);\n\n        \n    } failure:^(NSURLSessionTask *task, NSError *error, NSInteger statusCode) {\n        \n        NSLog(@\"request failed:%@\",error);\n    }];\n\n}\n\n\n\n- (IBAction)sendRequest_1_load_cache:(UIButton *)sender {\n    \n\n    [[SJNetworkManager sharedManager] sendGetRequest:_url1\n                                          parameters:_params_1\n                                           loadCache:YES\n                                       cacheDuration:10\n                                             success:^(id responseObject) {\n\n        NSLog(@\"request succeed:%@\",responseObject);\n\n    } failure:^(NSURLSessionTask *task, NSError *error, NSInteger statusCode) {\n        \n        NSLog(@\"request failed:%@\",error);\n    }];\n    \n}\n\n- (IBAction)cancelRequest_1:(UIButton *)sender {\n    \n\n//    [[SJNetworkManager sharedManager] cancelCurrentRequestWithUrl:_url1\n//                                                           method:@\"GET\"\n//                                                       parameters:_params_1];\n    \n    [[SJNetworkManager sharedManager] cancelCurrentRequestWithUrl:_url1];\n\n}\n\n- (IBAction)loadRequest_1_cache:(UIButton *)sender {\n    \n//    [[SJNetworkManager sharedManager] loadCacheWithUrl:_url1\n//                                                method:@\"GET\"\n//                                            parameters:_params_1\n//                                       completionBlock:^(id  _Nullable cacheObject) {\n//        NSLog(@\"%@\",cacheObject);\n//    }];\n    \n    \n    [[SJNetworkManager sharedManager] loadCacheWithUrl:_url1 completionBlock:^(NSArray * _Nullable cacheArr) {\n        \n        NSLog(@\"%@\",cacheArr);\n        \n    }];\n}\n\n\n\n- (IBAction)clearRequest_1_cache:(UIButton *)sender {\n    \n    \n    [[SJNetworkManager sharedManager] clearCacheWithUrl:_url1\n                                                 method:@\"GET\"\n                                             parameters:_params_1\n                                        completionBlock:^(BOOL isSuccess) {\n\n        if (isSuccess) {\n            NSLog(@\"Clearing cache successfully!\");\n        }\n    }];\n    \n    \n//    [[SJNetworkManager sharedManager] clearCacheWithUrl:_url1 completionBlock:^(BOOL isSuccess) {\n//\n//    }];\n}\n\n\n\n\n- (IBAction)sendRequest_1_request_2_not_load_cache:(UIButton *)sender {\n    \n    \n//    //send request 0\n//    [[SJNetworkManager sharedManager] sendGetRequest:_url0\n//                                          parameters:_params_0\n//                                             success:^(id responseObject) {\n//                                                 \n//                                                 NSLog(@\"request succeed:%@\",responseObject);\n//                                                 \n//                                             } failure:^(NSURLSessionTask *task, NSError *error, NSInteger statusCode) {\n//                                                 \n//                                                 NSLog(@\"request failed:%@\",error);\n//                                             }];\n    \n    //send request 1\n    [[SJNetworkManager sharedManager] sendGetRequest:_url1\n                                          parameters:_params_1\n                                             success:^(id responseObject) {\n        \n         NSLog(@\"request succeed:%@\",responseObject);\n                                                 \n    } failure:^(NSURLSessionTask *task, NSError *error, NSInteger statusCode) {\n        \n         NSLog(@\"request failed:%@\",error);\n    }];\n    \n    \n    //send request 2\n    [[SJNetworkManager sharedManager] sendGetRequest:_url2\n                                          parameters:_params_2\n                                             success:^(id responseObject) {\n        \n        NSLog(@\"request succeed:%@\",responseObject);\n                                                 \n    } failure:^(NSURLSessionTask *task, NSError *error, NSInteger statusCode) {\n        \n        NSLog(@\"request failed:%@\",error);\n        \n    }];\n    \n}\n\n\n\n\n- (IBAction)sendRequest_1_request_2_save_cache:(UIButton *)sender {\n    \n    \n    //send request 0\n    [[SJNetworkManager sharedManager] sendGetRequest:_url0\n                                          parameters:_params_0\n                                       cacheDuration:10\n                                             success:^(id responseObject) {\n                                                 \n         NSLog(@\"request succeed:%@\",responseObject);\n                                                 \n     } failure:^(NSURLSessionTask *task, NSError *error, NSInteger statusCode) {\n         \n         NSLog(@\"request failed:%@\",error);\n     }];\n    \n    //send request 1\n    [[SJNetworkManager sharedManager] sendGetRequest:_url1\n                                          parameters:_params_1\n                                       cacheDuration:10\n                                             success:^(id responseObject) {\n        \n         NSLog(@\"request succeed:%@\",responseObject);\n                                                 \n    } failure:^(NSURLSessionTask *task, NSError *error, NSInteger statusCode) {\n        \n         NSLog(@\"request failed:%@\",error);\n    }];\n    \n    \n    //send request 2\n    [[SJNetworkManager sharedManager] sendGetRequest:_url2\n                                          parameters:_params_2\n                                       cacheDuration:10\n                                             success:^(id responseObject) {\n        \n        NSLog(@\"request succeed:%@\",responseObject);\n                                                 \n    } failure:^(NSURLSessionTask *task, NSError *error, NSInteger statusCode) {\n        \n        NSLog(@\"request failed:%@\",error);\n    }];\n    \n}\n\n\n\n\n- (IBAction)sendRequest_1_request_2_load_cache:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] sendGetRequest:_url1\n                                          parameters:_params_1\n                                           loadCache:YES\n                                             success:^(id responseObject) {\n        \n    } failure:^(NSURLSessionTask *task, NSError *error, NSInteger statusCode) {\n        \n    }];\n    \n    [[SJNetworkManager sharedManager] sendGetRequest:_url2\n                                          parameters:_params_2\n                                           loadCache:YES\n                                             success:^(id responseObject) {\n        \n    } failure:^(NSURLSessionTask *task, NSError *error, NSInteger statusCode) {\n        \n    }];\n}\n\n- (IBAction)sendRequest1_request2_save_load_cache:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] sendGetRequest:_url1\n                                          parameters:_params_1\n                                           loadCache:YES\n                                       cacheDuration:10\n                                             success:^(id responseObject) {\n                                                 \n     } failure:^(NSURLSessionTask *task, NSError *error, NSInteger statusCode) {\n         \n     }];\n    \n    [[SJNetworkManager sharedManager] sendGetRequest:_url2\n                                          parameters:_params_2\n                                           loadCache:YES\n                                       cacheDuration:10\n                                             success:^(id responseObject) {\n                                                 \n     } failure:^(NSURLSessionTask *task, NSError *error, NSInteger statusCode) {\n         \n     }];\n    \n}\n\n\n- (IBAction)calculate_current_request_count:(UIButton *)sender {\n    \n    NSUInteger count = [[SJNetworkManager sharedManager] currentRequestCount];\n    if (count > 0) {\n        NSLog(@\"There is %lu requests\",(unsigned long)count);\n    }\n}\n\n\n\n\n- (IBAction)log_all_current_requests:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] logAllCurrentRequests];\n}\n\n\n\n\n- (IBAction)if_remain_current_requests:(UIButton *)sender {\n    \n    BOOL remaining =  [[SJNetworkManager sharedManager] remainingCurrentRequests];\n    if (remaining) {\n        NSLog(@\"There is remaining request\");\n    }\n}\n\n\n\n\n- (IBAction)cancel_all_current_requests:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] cancelAllCurrentRequests];\n    \n}\n\n\n- (IBAction)clear_all_cache:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] clearAllCacheCompletionBlock:^(BOOL isSuccess) {\n        \n    }];\n    \n    \n//    [[SJNetworkManager sharedManager] clearAllCacheCompletionBlock:nil];\n}\n\n\n\n\n- (IBAction)calculate_cache_size:(UIButton *)sender {\n    \n    [[SJNetworkManager sharedManager] calculateCacheSizeCompletionBlock:^(NSUInteger fileCount, NSUInteger totalSize, NSString *totalSizeString) {\n        \n        NSLog(@\"file count :%lu and total size:%lu total size string:%@\",(unsigned long)fileCount,(unsigned long)totalSize, totalSizeString);\n        \n    }];\n    \n}\n\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 48;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t4C612A51EBEC32C107815BAB /* libPods-SJNetworkingDemo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A57F5D2046E8373B41EF067 /* libPods-SJNetworkingDemo.a */; };\n\t\tCB73266F1FF2C91F002E2ACD /* SJNetworkCacheInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = CB7326551FF2C91F002E2ACD /* SJNetworkCacheInfo.m */; };\n\t\tCB7326701FF2C91F002E2ACD /* SJNetworkManager.m in Sources */ = {isa = PBXBuildFile; fileRef = CB7326581FF2C91F002E2ACD /* SJNetworkManager.m */; };\n\t\tCB7326711FF2C91F002E2ACD /* SJNetworkConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = CB7326591FF2C91F002E2ACD /* SJNetworkConfig.m */; };\n\t\tCB7326721FF2C91F002E2ACD /* SJNetworkDownloadResumeDataInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = CB73265A1FF2C91F002E2ACD /* SJNetworkDownloadResumeDataInfo.m */; };\n\t\tCB7326731FF2C91F002E2ACD /* SJNetworkDownloadEngine.m in Sources */ = {isa = PBXBuildFile; fileRef = CB73265B1FF2C91F002E2ACD /* SJNetworkDownloadEngine.m */; };\n\t\tCB7326741FF2C91F002E2ACD /* SJNetworkCacheManager.m in Sources */ = {isa = PBXBuildFile; fileRef = CB73265C1FF2C91F002E2ACD /* SJNetworkCacheManager.m */; };\n\t\tCB7326751FF2C91F002E2ACD /* SJNetworkRequestPool.m in Sources */ = {isa = PBXBuildFile; fileRef = CB73265D1FF2C91F002E2ACD /* SJNetworkRequestPool.m */; };\n\t\tCB7326761FF2C91F002E2ACD /* SJNetworkUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = CB73265E1FF2C91F002E2ACD /* SJNetworkUtils.m */; };\n\t\tCB7326771FF2C91F002E2ACD /* SJNetworkBaseEngine.m in Sources */ = {isa = PBXBuildFile; fileRef = CB73265F1FF2C91F002E2ACD /* SJNetworkBaseEngine.m */; };\n\t\tCB7326781FF2C91F002E2ACD /* SJNetworkUploadEngine.m in Sources */ = {isa = PBXBuildFile; fileRef = CB7326601FF2C91F002E2ACD /* SJNetworkUploadEngine.m */; };\n\t\tCB7326791FF2C91F002E2ACD /* SJNetworkRequestEngine.m in Sources */ = {isa = PBXBuildFile; fileRef = CB7326641FF2C91F002E2ACD /* SJNetworkRequestEngine.m */; };\n\t\tCB73267A1FF2C91F002E2ACD /* SJNetworkRequestModel.m in Sources */ = {isa = PBXBuildFile; fileRef = CB7326661FF2C91F002E2ACD /* SJNetworkRequestModel.m */; };\n\t\tCB9B897F1FC7226A00C4522C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = CB9B897E1FC7226A00C4522C /* AppDelegate.m */; };\n\t\tCB9B89851FC7226A00C4522C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CB9B89831FC7226A00C4522C /* Main.storyboard */; };\n\t\tCB9B89871FC7226A00C4522C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CB9B89861FC7226A00C4522C /* Assets.xcassets */; };\n\t\tCB9B898A1FC7226A00C4522C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CB9B89881FC7226A00C4522C /* LaunchScreen.storyboard */; };\n\t\tCB9B898D1FC7226A00C4522C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = CB9B898C1FC7226A00C4522C /* main.m */; };\n\t\tCB9B89971FC7226A00C4522C /* SJNetworkingDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CB9B89961FC7226A00C4522C /* SJNetworkingDemoTests.m */; };\n\t\tCB9B89A21FC7226A00C4522C /* SJNetworkingDemoUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = CB9B89A11FC7226A00C4522C /* SJNetworkingDemoUITests.m */; };\n\t\tCB9B89B61FC7234300C4522C /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CB9B89B11FC7234300C4522C /* ViewController.m */; };\n\t\tCB9B89B71FC7234300C4522C /* DownLoadViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CB9B89B31FC7234300C4522C /* DownLoadViewController.m */; };\n\t\tCB9B89B81FC7234300C4522C /* UploadViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CB9B89B41FC7234300C4522C /* UploadViewController.m */; };\n\t\tCB9B89BF1FC7234B00C4522C /* image_2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = CB9B89BA1FC7234B00C4522C /* image_2.jpg */; };\n\t\tCB9B89C01FC7234B00C4522C /* image_3.png in Resources */ = {isa = PBXBuildFile; fileRef = CB9B89BB1FC7234B00C4522C /* image_3.png */; };\n\t\tCB9B89C11FC7234B00C4522C /* image_1.jpg in Resources */ = {isa = PBXBuildFile; fileRef = CB9B89BC1FC7234B00C4522C /* image_1.jpg */; };\n\t\tCB9B89C21FC7234B00C4522C /* image_4.png in Resources */ = {isa = PBXBuildFile; fileRef = CB9B89BD1FC7234B00C4522C /* image_4.png */; };\n\t\tCB9B89C31FC7234B00C4522C /* image_5.png in Resources */ = {isa = PBXBuildFile; fileRef = CB9B89BE1FC7234B00C4522C /* image_5.png */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\tCB9B89931FC7226A00C4522C /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = CB9B89721FC7226A00C4522C /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = CB9B89791FC7226A00C4522C;\n\t\t\tremoteInfo = SJNetworkingDemo;\n\t\t};\n\t\tCB9B899E1FC7226A00C4522C /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = CB9B89721FC7226A00C4522C /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = CB9B89791FC7226A00C4522C;\n\t\t\tremoteInfo = SJNetworkingDemo;\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXFileReference section */\n\t\t7A57F5D2046E8373B41EF067 /* libPods-SJNetworkingDemo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = \"libPods-SJNetworkingDemo.a\"; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t7DD1551EFC2D5DD53F3B32C6 /* Pods-SJNetworkingDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = \"Pods-SJNetworkingDemo.release.xcconfig\"; path = \"Pods/Target Support Files/Pods-SJNetworkingDemo/Pods-SJNetworkingDemo.release.xcconfig\"; sourceTree = \"<group>\"; };\n\t\tCB7326541FF2C91F002E2ACD /* SJNetworkUploadEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SJNetworkUploadEngine.h; sourceTree = \"<group>\"; };\n\t\tCB7326551FF2C91F002E2ACD /* SJNetworkCacheInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SJNetworkCacheInfo.m; sourceTree = \"<group>\"; };\n\t\tCB7326561FF2C91F002E2ACD /* SJNetworkRequestModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SJNetworkRequestModel.h; sourceTree = \"<group>\"; };\n\t\tCB7326571FF2C91F002E2ACD /* SJNetworkRequestEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SJNetworkRequestEngine.h; sourceTree = \"<group>\"; };\n\t\tCB7326581FF2C91F002E2ACD /* SJNetworkManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SJNetworkManager.m; sourceTree = \"<group>\"; };\n\t\tCB7326591FF2C91F002E2ACD /* SJNetworkConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SJNetworkConfig.m; sourceTree = \"<group>\"; };\n\t\tCB73265A1FF2C91F002E2ACD /* SJNetworkDownloadResumeDataInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SJNetworkDownloadResumeDataInfo.m; sourceTree = \"<group>\"; };\n\t\tCB73265B1FF2C91F002E2ACD /* SJNetworkDownloadEngine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SJNetworkDownloadEngine.m; sourceTree = \"<group>\"; };\n\t\tCB73265C1FF2C91F002E2ACD /* SJNetworkCacheManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SJNetworkCacheManager.m; sourceTree = \"<group>\"; };\n\t\tCB73265D1FF2C91F002E2ACD /* SJNetworkRequestPool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SJNetworkRequestPool.m; sourceTree = \"<group>\"; };\n\t\tCB73265E1FF2C91F002E2ACD /* SJNetworkUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SJNetworkUtils.m; sourceTree = \"<group>\"; };\n\t\tCB73265F1FF2C91F002E2ACD /* SJNetworkBaseEngine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SJNetworkBaseEngine.m; sourceTree = \"<group>\"; };\n\t\tCB7326601FF2C91F002E2ACD /* SJNetworkUploadEngine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SJNetworkUploadEngine.m; sourceTree = \"<group>\"; };\n\t\tCB7326611FF2C91F002E2ACD /* SJNetworkCacheInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SJNetworkCacheInfo.h; sourceTree = \"<group>\"; };\n\t\tCB7326621FF2C91F002E2ACD /* SJNetworkManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SJNetworkManager.h; sourceTree = \"<group>\"; };\n\t\tCB7326631FF2C91F002E2ACD /* SJNetworkConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SJNetworkConfig.h; sourceTree = \"<group>\"; };\n\t\tCB7326641FF2C91F002E2ACD /* SJNetworkRequestEngine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SJNetworkRequestEngine.m; sourceTree = \"<group>\"; };\n\t\tCB7326651FF2C91F002E2ACD /* SJNetworkHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SJNetworkHeader.h; sourceTree = \"<group>\"; };\n\t\tCB7326661FF2C91F002E2ACD /* SJNetworkRequestModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SJNetworkRequestModel.m; sourceTree = \"<group>\"; };\n\t\tCB7326681FF2C91F002E2ACD /* SJNetworkProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SJNetworkProtocol.h; sourceTree = \"<group>\"; };\n\t\tCB7326691FF2C91F002E2ACD /* SJNetworkBaseEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SJNetworkBaseEngine.h; sourceTree = \"<group>\"; };\n\t\tCB73266A1FF2C91F002E2ACD /* SJNetworkUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SJNetworkUtils.h; sourceTree = \"<group>\"; };\n\t\tCB73266B1FF2C91F002E2ACD /* SJNetworkRequestPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SJNetworkRequestPool.h; sourceTree = \"<group>\"; };\n\t\tCB73266C1FF2C91F002E2ACD /* SJNetworkCacheManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SJNetworkCacheManager.h; sourceTree = \"<group>\"; };\n\t\tCB73266D1FF2C91F002E2ACD /* SJNetworkDownloadResumeDataInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SJNetworkDownloadResumeDataInfo.h; sourceTree = \"<group>\"; };\n\t\tCB73266E1FF2C91F002E2ACD /* SJNetworkDownloadEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SJNetworkDownloadEngine.h; sourceTree = \"<group>\"; };\n\t\tCB73267B1FF2C952002E2ACD /* SJNetwork.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SJNetwork.h; sourceTree = \"<group>\"; };\n\t\tCB9B897A1FC7226A00C4522C /* SJNetworkingDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SJNetworkingDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tCB9B897D1FC7226A00C4522C /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = \"<group>\"; };\n\t\tCB9B897E1FC7226A00C4522C /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = \"<group>\"; };\n\t\tCB9B89841FC7226A00C4522C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = \"<group>\"; };\n\t\tCB9B89861FC7226A00C4522C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = \"<group>\"; };\n\t\tCB9B89891FC7226A00C4522C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = \"<group>\"; };\n\t\tCB9B898B1FC7226A00C4522C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\tCB9B898C1FC7226A00C4522C /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = \"<group>\"; };\n\t\tCB9B89921FC7226A00C4522C /* SJNetworkingDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SJNetworkingDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tCB9B89961FC7226A00C4522C /* SJNetworkingDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SJNetworkingDemoTests.m; sourceTree = \"<group>\"; };\n\t\tCB9B89981FC7226A00C4522C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\tCB9B899D1FC7226A00C4522C /* SJNetworkingDemoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SJNetworkingDemoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tCB9B89A11FC7226A00C4522C /* SJNetworkingDemoUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SJNetworkingDemoUITests.m; sourceTree = \"<group>\"; };\n\t\tCB9B89A31FC7226A00C4522C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\tCB9B89B01FC7234300C4522C /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = \"<group>\"; };\n\t\tCB9B89B11FC7234300C4522C /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = \"<group>\"; };\n\t\tCB9B89B21FC7234300C4522C /* DownLoadViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DownLoadViewController.h; sourceTree = \"<group>\"; };\n\t\tCB9B89B31FC7234300C4522C /* DownLoadViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DownLoadViewController.m; sourceTree = \"<group>\"; };\n\t\tCB9B89B41FC7234300C4522C /* UploadViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UploadViewController.m; sourceTree = \"<group>\"; };\n\t\tCB9B89B51FC7234300C4522C /* UploadViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UploadViewController.h; sourceTree = \"<group>\"; };\n\t\tCB9B89BA1FC7234B00C4522C /* image_2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = image_2.jpg; sourceTree = \"<group>\"; };\n\t\tCB9B89BB1FC7234B00C4522C /* image_3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = image_3.png; sourceTree = \"<group>\"; };\n\t\tCB9B89BC1FC7234B00C4522C /* image_1.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = image_1.jpg; sourceTree = \"<group>\"; };\n\t\tCB9B89BD1FC7234B00C4522C /* image_4.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = image_4.png; sourceTree = \"<group>\"; };\n\t\tCB9B89BE1FC7234B00C4522C /* image_5.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = image_5.png; sourceTree = \"<group>\"; };\n\t\tEE92C5E63DA273CA29CEB0B8 /* Pods-SJNetworkingDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = \"Pods-SJNetworkingDemo.debug.xcconfig\"; path = \"Pods/Target Support Files/Pods-SJNetworkingDemo/Pods-SJNetworkingDemo.debug.xcconfig\"; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\tCB9B89771FC7226A00C4522C /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t4C612A51EBEC32C107815BAB /* libPods-SJNetworkingDemo.a in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tCB9B898F1FC7226A00C4522C /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tCB9B899A1FC7226A00C4522C /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t002CAE5ED1B5736ED6EBB63A /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t7A57F5D2046E8373B41EF067 /* libPods-SJNetworkingDemo.a */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tAE4E61BFA6D1F94AD4264C91 /* Pods */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tEE92C5E63DA273CA29CEB0B8 /* Pods-SJNetworkingDemo.debug.xcconfig */,\n\t\t\t\t7DD1551EFC2D5DD53F3B32C6 /* Pods-SJNetworkingDemo.release.xcconfig */,\n\t\t\t);\n\t\t\tname = Pods;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tCB7326531FF2C91F002E2ACD /* SJNetwork */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tCB73267B1FF2C952002E2ACD /* SJNetwork.h */,\n\t\t\t\tCB7326651FF2C91F002E2ACD /* SJNetworkHeader.h */,\n\t\t\t\tCB7326681FF2C91F002E2ACD /* SJNetworkProtocol.h */,\n\t\t\t\tCB7326621FF2C91F002E2ACD /* SJNetworkManager.h */,\n\t\t\t\tCB7326581FF2C91F002E2ACD /* SJNetworkManager.m */,\n\t\t\t\tCB7326691FF2C91F002E2ACD /* SJNetworkBaseEngine.h */,\n\t\t\t\tCB73265F1FF2C91F002E2ACD /* SJNetworkBaseEngine.m */,\n\t\t\t\tCB7326571FF2C91F002E2ACD /* SJNetworkRequestEngine.h */,\n\t\t\t\tCB7326641FF2C91F002E2ACD /* SJNetworkRequestEngine.m */,\n\t\t\t\tCB7326541FF2C91F002E2ACD /* SJNetworkUploadEngine.h */,\n\t\t\t\tCB7326601FF2C91F002E2ACD /* SJNetworkUploadEngine.m */,\n\t\t\t\tCB73266E1FF2C91F002E2ACD /* SJNetworkDownloadEngine.h */,\n\t\t\t\tCB73265B1FF2C91F002E2ACD /* SJNetworkDownloadEngine.m */,\n\t\t\t\tCB7326561FF2C91F002E2ACD /* SJNetworkRequestModel.h */,\n\t\t\t\tCB7326661FF2C91F002E2ACD /* SJNetworkRequestModel.m */,\n\t\t\t\tCB73266B1FF2C91F002E2ACD /* SJNetworkRequestPool.h */,\n\t\t\t\tCB73265D1FF2C91F002E2ACD /* SJNetworkRequestPool.m */,\n\t\t\t\tCB73266C1FF2C91F002E2ACD /* SJNetworkCacheManager.h */,\n\t\t\t\tCB73265C1FF2C91F002E2ACD /* SJNetworkCacheManager.m */,\n\t\t\t\tCB7326611FF2C91F002E2ACD /* SJNetworkCacheInfo.h */,\n\t\t\t\tCB7326551FF2C91F002E2ACD /* SJNetworkCacheInfo.m */,\n\t\t\t\tCB73266D1FF2C91F002E2ACD /* SJNetworkDownloadResumeDataInfo.h */,\n\t\t\t\tCB73265A1FF2C91F002E2ACD /* SJNetworkDownloadResumeDataInfo.m */,\n\t\t\t\tCB7326631FF2C91F002E2ACD /* SJNetworkConfig.h */,\n\t\t\t\tCB7326591FF2C91F002E2ACD /* SJNetworkConfig.m */,\n\t\t\t\tCB73266A1FF2C91F002E2ACD /* SJNetworkUtils.h */,\n\t\t\t\tCB73265E1FF2C91F002E2ACD /* SJNetworkUtils.m */,\n\t\t\t);\n\t\t\tpath = SJNetwork;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tCB9B89711FC7226A00C4522C = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tCB9B897C1FC7226A00C4522C /* SJNetworkingDemo */,\n\t\t\t\tCB9B89951FC7226A00C4522C /* SJNetworkingDemoTests */,\n\t\t\t\tCB9B89A01FC7226A00C4522C /* SJNetworkingDemoUITests */,\n\t\t\t\tCB9B897B1FC7226A00C4522C /* Products */,\n\t\t\t\tAE4E61BFA6D1F94AD4264C91 /* Pods */,\n\t\t\t\t002CAE5ED1B5736ED6EBB63A /* Frameworks */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tCB9B897B1FC7226A00C4522C /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tCB9B897A1FC7226A00C4522C /* SJNetworkingDemo.app */,\n\t\t\t\tCB9B89921FC7226A00C4522C /* SJNetworkingDemoTests.xctest */,\n\t\t\t\tCB9B899D1FC7226A00C4522C /* SJNetworkingDemoUITests.xctest */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tCB9B897C1FC7226A00C4522C /* SJNetworkingDemo */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tCB9B89AF1FC7232B00C4522C /* ViewController */,\n\t\t\t\tCB7326531FF2C91F002E2ACD /* SJNetwork */,\n\t\t\t\tCB9B89C41FC7235900C4522C /* Other */,\n\t\t\t);\n\t\t\tpath = SJNetworkingDemo;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tCB9B89951FC7226A00C4522C /* SJNetworkingDemoTests */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tCB9B89961FC7226A00C4522C /* SJNetworkingDemoTests.m */,\n\t\t\t\tCB9B89981FC7226A00C4522C /* Info.plist */,\n\t\t\t);\n\t\t\tpath = SJNetworkingDemoTests;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tCB9B89A01FC7226A00C4522C /* SJNetworkingDemoUITests */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tCB9B89A11FC7226A00C4522C /* SJNetworkingDemoUITests.m */,\n\t\t\t\tCB9B89A31FC7226A00C4522C /* Info.plist */,\n\t\t\t);\n\t\t\tpath = SJNetworkingDemoUITests;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tCB9B89AF1FC7232B00C4522C /* ViewController */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tCB9B89B01FC7234300C4522C /* ViewController.h */,\n\t\t\t\tCB9B89B11FC7234300C4522C /* ViewController.m */,\n\t\t\t\tCB9B89B51FC7234300C4522C /* UploadViewController.h */,\n\t\t\t\tCB9B89B41FC7234300C4522C /* UploadViewController.m */,\n\t\t\t\tCB9B89B21FC7234300C4522C /* DownLoadViewController.h */,\n\t\t\t\tCB9B89B31FC7234300C4522C /* DownLoadViewController.m */,\n\t\t\t);\n\t\t\tpath = ViewController;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tCB9B89B91FC7234B00C4522C /* images */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tCB9B89BC1FC7234B00C4522C /* image_1.jpg */,\n\t\t\t\tCB9B89BA1FC7234B00C4522C /* image_2.jpg */,\n\t\t\t\tCB9B89BB1FC7234B00C4522C /* image_3.png */,\n\t\t\t\tCB9B89BD1FC7234B00C4522C /* image_4.png */,\n\t\t\t\tCB9B89BE1FC7234B00C4522C /* image_5.png */,\n\t\t\t);\n\t\t\tpath = images;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tCB9B89C41FC7235900C4522C /* Other */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tCB9B897D1FC7226A00C4522C /* AppDelegate.h */,\n\t\t\t\tCB9B897E1FC7226A00C4522C /* AppDelegate.m */,\n\t\t\t\tCB9B89831FC7226A00C4522C /* Main.storyboard */,\n\t\t\t\tCB9B89861FC7226A00C4522C /* Assets.xcassets */,\n\t\t\t\tCB9B89B91FC7234B00C4522C /* images */,\n\t\t\t\tCB9B89881FC7226A00C4522C /* LaunchScreen.storyboard */,\n\t\t\t\tCB9B898B1FC7226A00C4522C /* Info.plist */,\n\t\t\t\tCB9B898C1FC7226A00C4522C /* main.m */,\n\t\t\t);\n\t\t\tpath = Other;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXNativeTarget section */\n\t\tCB9B89791FC7226A00C4522C /* SJNetworkingDemo */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = CB9B89A61FC7226A00C4522C /* Build configuration list for PBXNativeTarget \"SJNetworkingDemo\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t178DF2658A89583847970ACA /* [CP] Check Pods Manifest.lock */,\n\t\t\t\tCB9B89761FC7226A00C4522C /* Sources */,\n\t\t\t\tCB9B89771FC7226A00C4522C /* Frameworks */,\n\t\t\t\tCB9B89781FC7226A00C4522C /* Resources */,\n\t\t\t\t5DF0DB54A7F3ADFCF7C47535 /* [CP] Embed Pods Frameworks */,\n\t\t\t\t27382A79029207E59A319B25 /* [CP] Copy Pods Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = SJNetworkingDemo;\n\t\t\tproductName = SJNetworkingDemo;\n\t\t\tproductReference = CB9B897A1FC7226A00C4522C /* SJNetworkingDemo.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\tCB9B89911FC7226A00C4522C /* SJNetworkingDemoTests */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = CB9B89A91FC7226A00C4522C /* Build configuration list for PBXNativeTarget \"SJNetworkingDemoTests\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tCB9B898E1FC7226A00C4522C /* Sources */,\n\t\t\t\tCB9B898F1FC7226A00C4522C /* Frameworks */,\n\t\t\t\tCB9B89901FC7226A00C4522C /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\tCB9B89941FC7226A00C4522C /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = SJNetworkingDemoTests;\n\t\t\tproductName = SJNetworkingDemoTests;\n\t\t\tproductReference = CB9B89921FC7226A00C4522C /* SJNetworkingDemoTests.xctest */;\n\t\t\tproductType = \"com.apple.product-type.bundle.unit-test\";\n\t\t};\n\t\tCB9B899C1FC7226A00C4522C /* SJNetworkingDemoUITests */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = CB9B89AC1FC7226A00C4522C /* Build configuration list for PBXNativeTarget \"SJNetworkingDemoUITests\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tCB9B89991FC7226A00C4522C /* Sources */,\n\t\t\t\tCB9B899A1FC7226A00C4522C /* Frameworks */,\n\t\t\t\tCB9B899B1FC7226A00C4522C /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\tCB9B899F1FC7226A00C4522C /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = SJNetworkingDemoUITests;\n\t\t\tproductName = SJNetworkingDemoUITests;\n\t\t\tproductReference = CB9B899D1FC7226A00C4522C /* SJNetworkingDemoUITests.xctest */;\n\t\t\tproductType = \"com.apple.product-type.bundle.ui-testing\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tCB9B89721FC7226A00C4522C /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastUpgradeCheck = 0910;\n\t\t\t\tORGANIZATIONNAME = Shijie;\n\t\t\t\tTargetAttributes = {\n\t\t\t\t\tCB9B89791FC7226A00C4522C = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 9.1;\n\t\t\t\t\t\tProvisioningStyle = Automatic;\n\t\t\t\t\t};\n\t\t\t\t\tCB9B89911FC7226A00C4522C = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 9.1;\n\t\t\t\t\t\tProvisioningStyle = Automatic;\n\t\t\t\t\t\tTestTargetID = CB9B89791FC7226A00C4522C;\n\t\t\t\t\t};\n\t\t\t\t\tCB9B899C1FC7226A00C4522C = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 9.1;\n\t\t\t\t\t\tProvisioningStyle = Automatic;\n\t\t\t\t\t\tTestTargetID = CB9B89791FC7226A00C4522C;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tbuildConfigurationList = CB9B89751FC7226A00C4522C /* Build configuration list for PBXProject \"SJNetworkingDemo\" */;\n\t\t\tcompatibilityVersion = \"Xcode 8.0\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t\tBase,\n\t\t\t);\n\t\t\tmainGroup = CB9B89711FC7226A00C4522C;\n\t\t\tproductRefGroup = CB9B897B1FC7226A00C4522C /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\tCB9B89791FC7226A00C4522C /* SJNetworkingDemo */,\n\t\t\t\tCB9B89911FC7226A00C4522C /* SJNetworkingDemoTests */,\n\t\t\t\tCB9B899C1FC7226A00C4522C /* SJNetworkingDemoUITests */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\tCB9B89781FC7226A00C4522C /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tCB9B898A1FC7226A00C4522C /* LaunchScreen.storyboard in Resources */,\n\t\t\t\tCB9B89C21FC7234B00C4522C /* image_4.png in Resources */,\n\t\t\t\tCB9B89871FC7226A00C4522C /* Assets.xcassets in Resources */,\n\t\t\t\tCB9B89BF1FC7234B00C4522C /* image_2.jpg in Resources */,\n\t\t\t\tCB9B89C01FC7234B00C4522C /* image_3.png in Resources */,\n\t\t\t\tCB9B89C31FC7234B00C4522C /* image_5.png in Resources */,\n\t\t\t\tCB9B89851FC7226A00C4522C /* Main.storyboard in Resources */,\n\t\t\t\tCB9B89C11FC7234B00C4522C /* image_1.jpg in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tCB9B89901FC7226A00C4522C /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tCB9B899B1FC7226A00C4522C /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXShellScriptBuildPhase section */\n\t\t178DF2658A89583847970ACA /* [CP] Check Pods Manifest.lock */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t\t\"${PODS_PODFILE_DIR_PATH}/Podfile.lock\",\n\t\t\t\t\"${PODS_ROOT}/Manifest.lock\",\n\t\t\t);\n\t\t\tname = \"[CP] Check Pods Manifest.lock\";\n\t\t\toutputPaths = (\n\t\t\t\t\"$(DERIVED_FILE_DIR)/Pods-SJNetworkingDemo-checkManifestLockResult.txt\",\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"diff \\\"${PODS_PODFILE_DIR_PATH}/Podfile.lock\\\" \\\"${PODS_ROOT}/Manifest.lock\\\" > /dev/null\\nif [ $? != 0 ] ; then\\n    # print error to STDERR\\n    echo \\\"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\\\" >&2\\n    exit 1\\nfi\\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\\necho \\\"SUCCESS\\\" > \\\"${SCRIPT_OUTPUT_FILE_0}\\\"\\n\";\n\t\t\tshowEnvVarsInLog = 0;\n\t\t};\n\t\t27382A79029207E59A319B25 /* [CP] Copy Pods Resources */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t);\n\t\t\tname = \"[CP] Copy Pods Resources\";\n\t\t\toutputPaths = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"\\\"${SRCROOT}/Pods/Target Support Files/Pods-SJNetworkingDemo/Pods-SJNetworkingDemo-resources.sh\\\"\\n\";\n\t\t\tshowEnvVarsInLog = 0;\n\t\t};\n\t\t5DF0DB54A7F3ADFCF7C47535 /* [CP] Embed Pods Frameworks */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t);\n\t\t\tname = \"[CP] Embed Pods Frameworks\";\n\t\t\toutputPaths = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"\\\"${SRCROOT}/Pods/Target Support Files/Pods-SJNetworkingDemo/Pods-SJNetworkingDemo-frameworks.sh\\\"\\n\";\n\t\t\tshowEnvVarsInLog = 0;\n\t\t};\n/* End PBXShellScriptBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\tCB9B89761FC7226A00C4522C /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tCB73267A1FF2C91F002E2ACD /* SJNetworkRequestModel.m in Sources */,\n\t\t\t\tCB9B89B61FC7234300C4522C /* ViewController.m in Sources */,\n\t\t\t\tCB7326761FF2C91F002E2ACD /* SJNetworkUtils.m in Sources */,\n\t\t\t\tCB7326711FF2C91F002E2ACD /* SJNetworkConfig.m in Sources */,\n\t\t\t\tCB9B898D1FC7226A00C4522C /* main.m in Sources */,\n\t\t\t\tCB9B89B71FC7234300C4522C /* DownLoadViewController.m in Sources */,\n\t\t\t\tCB9B89B81FC7234300C4522C /* UploadViewController.m in Sources */,\n\t\t\t\tCB7326771FF2C91F002E2ACD /* SJNetworkBaseEngine.m in Sources */,\n\t\t\t\tCB7326781FF2C91F002E2ACD /* SJNetworkUploadEngine.m in Sources */,\n\t\t\t\tCB73266F1FF2C91F002E2ACD /* SJNetworkCacheInfo.m in Sources */,\n\t\t\t\tCB7326791FF2C91F002E2ACD /* SJNetworkRequestEngine.m in Sources */,\n\t\t\t\tCB9B897F1FC7226A00C4522C /* AppDelegate.m in Sources */,\n\t\t\t\tCB7326721FF2C91F002E2ACD /* SJNetworkDownloadResumeDataInfo.m in Sources */,\n\t\t\t\tCB7326701FF2C91F002E2ACD /* SJNetworkManager.m in Sources */,\n\t\t\t\tCB7326731FF2C91F002E2ACD /* SJNetworkDownloadEngine.m in Sources */,\n\t\t\t\tCB7326741FF2C91F002E2ACD /* SJNetworkCacheManager.m in Sources */,\n\t\t\t\tCB7326751FF2C91F002E2ACD /* SJNetworkRequestPool.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tCB9B898E1FC7226A00C4522C /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tCB9B89971FC7226A00C4522C /* SJNetworkingDemoTests.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tCB9B89991FC7226A00C4522C /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tCB9B89A21FC7226A00C4522C /* SJNetworkingDemoUITests.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\tCB9B89941FC7226A00C4522C /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = CB9B89791FC7226A00C4522C /* SJNetworkingDemo */;\n\t\t\ttargetProxy = CB9B89931FC7226A00C4522C /* PBXContainerItemProxy */;\n\t\t};\n\t\tCB9B899F1FC7226A00C4522C /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = CB9B89791FC7226A00C4522C /* SJNetworkingDemo */;\n\t\t\ttargetProxy = CB9B899E1FC7226A00C4522C /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin PBXVariantGroup section */\n\t\tCB9B89831FC7226A00C4522C /* Main.storyboard */ = {\n\t\t\tisa = PBXVariantGroup;\n\t\t\tchildren = (\n\t\t\t\tCB9B89841FC7226A00C4522C /* Base */,\n\t\t\t);\n\t\t\tname = Main.storyboard;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tCB9B89881FC7226A00C4522C /* LaunchScreen.storyboard */ = {\n\t\t\tisa = PBXVariantGroup;\n\t\t\tchildren = (\n\t\t\t\tCB9B89891FC7226A00C4522C /* Base */,\n\t\t\t);\n\t\t\tname = LaunchScreen.storyboard;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXVariantGroup section */\n\n/* Begin XCBuildConfiguration section */\n\t\tCB9B89A41FC7226A00C4522C /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCODE_SIGN_IDENTITY = \"iPhone Developer\";\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 11.1;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tCB9B89A51FC7226A00C4522C /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCODE_SIGN_IDENTITY = \"iPhone Developer\";\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 11.1;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tCB9B89A71FC7226A00C4522C /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = EE92C5E63DA273CA29CEB0B8 /* Pods-SJNetworkingDemo.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tDEVELOPMENT_TEAM = 5V6R56268H;\n\t\t\t\tINFOPLIST_FILE = \"$(SRCROOT)/SJNetworkingDemo/Other/Info.plist\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 10.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.shijie.SJNetworkingDemo;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tCB9B89A81FC7226A00C4522C /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 7DD1551EFC2D5DD53F3B32C6 /* Pods-SJNetworkingDemo.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tDEVELOPMENT_TEAM = 5V6R56268H;\n\t\t\t\tINFOPLIST_FILE = \"$(SRCROOT)/SJNetworkingDemo/Other/Info.plist\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 10.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.shijie.SJNetworkingDemo;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tCB9B89AA1FC7226A00C4522C /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tBUNDLE_LOADER = \"$(TEST_HOST)\";\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tINFOPLIST_FILE = SJNetworkingDemoTests/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.shijie.SJNetworkingDemoTests;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tTEST_HOST = \"$(BUILT_PRODUCTS_DIR)/SJNetworkingDemo.app/SJNetworkingDemo\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tCB9B89AB1FC7226A00C4522C /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tBUNDLE_LOADER = \"$(TEST_HOST)\";\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tINFOPLIST_FILE = SJNetworkingDemoTests/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.shijie.SJNetworkingDemoTests;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tTEST_HOST = \"$(BUILT_PRODUCTS_DIR)/SJNetworkingDemo.app/SJNetworkingDemo\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tCB9B89AD1FC7226A00C4522C /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tINFOPLIST_FILE = SJNetworkingDemoUITests/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.shijie.SJNetworkingDemoUITests;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tTEST_TARGET_NAME = SJNetworkingDemo;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tCB9B89AE1FC7226A00C4522C /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tINFOPLIST_FILE = SJNetworkingDemoUITests/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.shijie.SJNetworkingDemoUITests;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tTEST_TARGET_NAME = SJNetworkingDemo;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\tCB9B89751FC7226A00C4522C /* Build configuration list for PBXProject \"SJNetworkingDemo\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tCB9B89A41FC7226A00C4522C /* Debug */,\n\t\t\t\tCB9B89A51FC7226A00C4522C /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tCB9B89A61FC7226A00C4522C /* Build configuration list for PBXNativeTarget \"SJNetworkingDemo\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tCB9B89A71FC7226A00C4522C /* Debug */,\n\t\t\t\tCB9B89A81FC7226A00C4522C /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tCB9B89A91FC7226A00C4522C /* Build configuration list for PBXNativeTarget \"SJNetworkingDemoTests\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tCB9B89AA1FC7226A00C4522C /* Debug */,\n\t\t\t\tCB9B89AB1FC7226A00C4522C /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tCB9B89AC1FC7226A00C4522C /* Build configuration list for PBXNativeTarget \"SJNetworkingDemoUITests\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tCB9B89AD1FC7226A00C4522C /* Debug */,\n\t\t\t\tCB9B89AE1FC7226A00C4522C /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = CB9B89721FC7226A00C4522C /* Project object */;\n}\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"self:SJNetworkingDemo.xcodeproj\">\n   </FileRef>\n</Workspace>\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo.xcodeproj/xcuserdata/SunShijie.xcuserdatad/xcschemes/SJNetworkingDemo.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"0910\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"CB9B89791FC7226A00C4522C\"\n               BuildableName = \"SJNetworkingDemo.app\"\n               BlueprintName = \"SJNetworkingDemo\"\n               ReferencedContainer = \"container:SJNetworkingDemo.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      language = \"\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\">\n      <Testables>\n         <TestableReference\n            skipped = \"NO\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"CB9B89911FC7226A00C4522C\"\n               BuildableName = \"SJNetworkingDemoTests.xctest\"\n               BlueprintName = \"SJNetworkingDemoTests\"\n               ReferencedContainer = \"container:SJNetworkingDemo.xcodeproj\">\n            </BuildableReference>\n         </TestableReference>\n         <TestableReference\n            skipped = \"NO\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"CB9B899C1FC7226A00C4522C\"\n               BuildableName = \"SJNetworkingDemoUITests.xctest\"\n               BlueprintName = \"SJNetworkingDemoUITests\"\n               ReferencedContainer = \"container:SJNetworkingDemo.xcodeproj\">\n            </BuildableReference>\n         </TestableReference>\n      </Testables>\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"CB9B89791FC7226A00C4522C\"\n            BuildableName = \"SJNetworkingDemo.app\"\n            BlueprintName = \"SJNetworkingDemo\"\n            ReferencedContainer = \"container:SJNetworkingDemo.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <AdditionalOptions>\n      </AdditionalOptions>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      language = \"\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"CB9B89791FC7226A00C4522C\"\n            BuildableName = \"SJNetworkingDemo.app\"\n            BlueprintName = \"SJNetworkingDemo\"\n            ReferencedContainer = \"container:SJNetworkingDemo.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n      <AdditionalOptions>\n      </AdditionalOptions>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"CB9B89791FC7226A00C4522C\"\n            BuildableName = \"SJNetworkingDemo.app\"\n            BlueprintName = \"SJNetworkingDemo\"\n            ReferencedContainer = \"container:SJNetworkingDemo.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo.xcodeproj/xcuserdata/SunShijie.xcuserdatad/xcschemes/xcschememanagement.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>SchemeUserState</key>\n\t<dict>\n\t\t<key>SJNetworkingDemo.xcscheme</key>\n\t\t<dict>\n\t\t\t<key>orderHint</key>\n\t\t\t<integer>2</integer>\n\t\t</dict>\n\t</dict>\n\t<key>SuppressBuildableAutocreation</key>\n\t<dict>\n\t\t<key>CB9B89791FC7226A00C4522C</key>\n\t\t<dict>\n\t\t\t<key>primary</key>\n\t\t\t<true/>\n\t\t</dict>\n\t\t<key>CB9B89911FC7226A00C4522C</key>\n\t\t<dict>\n\t\t\t<key>primary</key>\n\t\t\t<true/>\n\t\t</dict>\n\t\t<key>CB9B899C1FC7226A00C4522C</key>\n\t\t<dict>\n\t\t\t<key>primary</key>\n\t\t\t<true/>\n\t\t</dict>\n\t</dict>\n</dict>\n</plist>\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo.xcworkspace/contents.xcworkspacedata",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"group:SJNetworkingDemo.xcodeproj\">\n   </FileRef>\n   <FileRef\n      location = \"group:Pods/Pods.xcodeproj\">\n   </FileRef>\n</Workspace>\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemo.xcworkspace/xcuserdata/SunShijie.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Bucket\n   type = \"0\"\n   version = \"2.0\">\n   <Breakpoints>\n      <BreakpointProxy\n         BreakpointExtensionID = \"Xcode.Breakpoint.ExceptionBreakpoint\">\n         <BreakpointContent\n            shouldBeEnabled = \"Yes\"\n            ignoreCount = \"0\"\n            continueAfterRunningActions = \"No\"\n            scope = \"0\"\n            stopOnStyle = \"0\">\n         </BreakpointContent>\n      </BreakpointProxy>\n      <BreakpointProxy\n         BreakpointExtensionID = \"Xcode.Breakpoint.ExceptionBreakpoint\">\n         <BreakpointContent\n            shouldBeEnabled = \"Yes\"\n            ignoreCount = \"0\"\n            continueAfterRunningActions = \"No\"\n            scope = \"0\"\n            stopOnStyle = \"0\">\n         </BreakpointContent>\n      </BreakpointProxy>\n      <BreakpointProxy\n         BreakpointExtensionID = \"Xcode.Breakpoint.FileBreakpoint\">\n         <BreakpointContent\n            shouldBeEnabled = \"Yes\"\n            ignoreCount = \"0\"\n            continueAfterRunningActions = \"No\"\n            filePath = \"SJNetworkingDemo/SJNetworking/SJNetworkDownloadManager.m\"\n            timestampString = \"535942083.03867\"\n            startingColumnNumber = \"9223372036854775807\"\n            endingColumnNumber = \"9223372036854775807\"\n            startingLineNumber = \"1102\"\n            endingLineNumber = \"1102\"\n            landmarkName = \"-URLSession:task:didCompleteWithError:\"\n            landmarkType = \"7\">\n         </BreakpointContent>\n      </BreakpointProxy>\n      <BreakpointProxy\n         BreakpointExtensionID = \"Xcode.Breakpoint.FileBreakpoint\">\n         <BreakpointContent\n            shouldBeEnabled = \"Yes\"\n            ignoreCount = \"0\"\n            continueAfterRunningActions = \"No\"\n            filePath = \"SJNetworkingDemo/SJNetworking/SJNetworkDownloadManager.m\"\n            timestampString = \"535942084.919405\"\n            startingColumnNumber = \"9223372036854775807\"\n            endingColumnNumber = \"9223372036854775807\"\n            startingLineNumber = \"1170\"\n            endingLineNumber = \"1170\"\n            landmarkName = \"-URLSession:dataTask:didReceiveResponse:completionHandler:\"\n            landmarkType = \"7\">\n         </BreakpointContent>\n      </BreakpointProxy>\n      <BreakpointProxy\n         BreakpointExtensionID = \"Xcode.Breakpoint.FileBreakpoint\">\n         <BreakpointContent\n            shouldBeEnabled = \"Yes\"\n            ignoreCount = \"0\"\n            continueAfterRunningActions = \"No\"\n            filePath = \"SJNetworkingDemo/SJNetworking/SJNetworkDownloadManager.m\"\n            timestampString = \"535942086.671954\"\n            startingColumnNumber = \"9223372036854775807\"\n            endingColumnNumber = \"9223372036854775807\"\n            startingLineNumber = \"1285\"\n            endingLineNumber = \"1285\"\n            landmarkName = \"-URLSession:downloadTask:didFinishDownloadingToURL:\"\n            landmarkType = \"7\">\n         </BreakpointContent>\n      </BreakpointProxy>\n      <BreakpointProxy\n         BreakpointExtensionID = \"Xcode.Breakpoint.FileBreakpoint\">\n         <BreakpointContent\n            shouldBeEnabled = \"Yes\"\n            ignoreCount = \"0\"\n            continueAfterRunningActions = \"No\"\n            filePath = \"SJNetworkingDemo/SJNetworking/SJNetworkDownloadManager.m\"\n            timestampString = \"535942088.459777\"\n            startingColumnNumber = \"9223372036854775807\"\n            endingColumnNumber = \"9223372036854775807\"\n            startingLineNumber = \"1316\"\n            endingLineNumber = \"1316\"\n            landmarkName = \"-URLSession:downloadTask:didFinishDownloadingToURL:\"\n            landmarkType = \"7\">\n         </BreakpointContent>\n      </BreakpointProxy>\n      <BreakpointProxy\n         BreakpointExtensionID = \"Xcode.Breakpoint.FileBreakpoint\">\n         <BreakpointContent\n            shouldBeEnabled = \"Yes\"\n            ignoreCount = \"0\"\n            continueAfterRunningActions = \"No\"\n            filePath = \"SJNetworkingDemo/SJNetworking/SJNetworkDownloadEngine.m\"\n            timestampString = \"535992383.592978\"\n            startingColumnNumber = \"9223372036854775807\"\n            endingColumnNumber = \"9223372036854775807\"\n            startingLineNumber = \"394\"\n            endingLineNumber = \"394\"\n            landmarkName = \"-resumeAllDownloadRequests\"\n            landmarkType = \"7\">\n         </BreakpointContent>\n      </BreakpointProxy>\n      <BreakpointProxy\n         BreakpointExtensionID = \"Xcode.Breakpoint.FileBreakpoint\">\n         <BreakpointContent\n            shouldBeEnabled = \"Yes\"\n            ignoreCount = \"0\"\n            continueAfterRunningActions = \"No\"\n            filePath = \"SJNetworkingDemo/SJNetworking/SJNetworkDownloadEngine.m\"\n            timestampString = \"535992383.593081\"\n            startingColumnNumber = \"9223372036854775807\"\n            endingColumnNumber = \"9223372036854775807\"\n            startingLineNumber = \"397\"\n            endingLineNumber = \"397\"\n            landmarkName = \"-resumeAllDownloadRequests\"\n            landmarkType = \"7\">\n         </BreakpointContent>\n      </BreakpointProxy>\n      <BreakpointProxy\n         BreakpointExtensionID = \"Xcode.Breakpoint.FileBreakpoint\">\n         <BreakpointContent\n            shouldBeEnabled = \"Yes\"\n            ignoreCount = \"0\"\n            continueAfterRunningActions = \"No\"\n            filePath = \"SJNetworkingDemo/SJNetworking/SJNetworkDownloadEngine.m\"\n            timestampString = \"535992383.593205\"\n            startingColumnNumber = \"9223372036854775807\"\n            endingColumnNumber = \"9223372036854775807\"\n            startingLineNumber = \"1219\"\n            endingLineNumber = \"1219\"\n            landmarkName = \"-URLSession:dataTask:didReceiveData:\"\n            landmarkType = \"7\">\n         </BreakpointContent>\n      </BreakpointProxy>\n      <BreakpointProxy\n         BreakpointExtensionID = \"Xcode.Breakpoint.FileBreakpoint\">\n         <BreakpointContent\n            shouldBeEnabled = \"Yes\"\n            ignoreCount = \"0\"\n            continueAfterRunningActions = \"No\"\n            filePath = \"SJNetworkingDemo/SJNetworking/SJNetworkDownloadEngine.m\"\n            timestampString = \"535992383.59328\"\n            startingColumnNumber = \"9223372036854775807\"\n            endingColumnNumber = \"9223372036854775807\"\n            startingLineNumber = \"1141\"\n            endingLineNumber = \"1141\"\n            landmarkName = \"-URLSession:dataTask:didReceiveResponse:completionHandler:\"\n            landmarkType = \"7\">\n         </BreakpointContent>\n      </BreakpointProxy>\n      <BreakpointProxy\n         BreakpointExtensionID = \"Xcode.Breakpoint.FileBreakpoint\">\n         <BreakpointContent\n            shouldBeEnabled = \"Yes\"\n            ignoreCount = \"0\"\n            continueAfterRunningActions = \"No\"\n            filePath = \"SJNetworkingDemo/SJNetworking/SJNetworkDownloadEngine.m\"\n            timestampString = \"535992383.593358\"\n            startingColumnNumber = \"9223372036854775807\"\n            endingColumnNumber = \"9223372036854775807\"\n            startingLineNumber = \"962\"\n            endingLineNumber = \"962\"\n            landmarkName = \"-URLSession:task:didCompleteWithError:\"\n            landmarkType = \"7\">\n         </BreakpointContent>\n      </BreakpointProxy>\n   </Breakpoints>\n</Bucket>\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemoTests/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>$(DEVELOPMENT_LANGUAGE)</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>BNDL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemoTests/SJNetworkingDemoTests.m",
    "content": "//\n//  SJNetworkingDemoTests.m\n//  SJNetworkingDemoTests\n//\n//  Created by Sun Shijie on 2017/11/23.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <XCTest/XCTest.h>\n\n@interface SJNetworkingDemoTests : XCTestCase\n\n@end\n\n@implementation SJNetworkingDemoTests\n\n- (void)setUp {\n    [super setUp];\n    // Put setup code here. This method is called before the invocation of each test method in the class.\n}\n\n- (void)tearDown {\n    // Put teardown code here. This method is called after the invocation of each test method in the class.\n    [super tearDown];\n}\n\n- (void)testExample {\n    // This is an example of a functional test case.\n    // Use XCTAssert and related functions to verify your tests produce the correct results.\n}\n\n- (void)testPerformanceExample {\n    // This is an example of a performance test case.\n    [self measureBlock:^{\n        // Put the code you want to measure the time of here.\n    }];\n}\n\n@end\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemoUITests/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>$(DEVELOPMENT_LANGUAGE)</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>BNDL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "SJNetworkDemo/SJNetworkingDemoUITests/SJNetworkingDemoUITests.m",
    "content": "//\n//  SJNetworkingDemoUITests.m\n//  SJNetworkingDemoUITests\n//\n//  Created by Sun Shijie on 2017/11/23.\n//  Copyright © 2017年 Shijie. All rights reserved.\n//\n\n#import <XCTest/XCTest.h>\n\n@interface SJNetworkingDemoUITests : XCTestCase\n\n@end\n\n@implementation SJNetworkingDemoUITests\n\n- (void)setUp {\n    [super setUp];\n    \n    // Put setup code here. This method is called before the invocation of each test method in the class.\n    \n    // In UI tests it is usually best to stop immediately when a failure occurs.\n    self.continueAfterFailure = NO;\n    // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.\n    [[[XCUIApplication alloc] init] launch];\n    \n    // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.\n}\n\n- (void)tearDown {\n    // Put teardown code here. This method is called after the invocation of each test method in the class.\n    [super tearDown];\n}\n\n- (void)testExample {\n    // Use recording to get started writing UI tests.\n    // Use XCTAssert and related functions to verify your tests produce the correct results.\n}\n\n@end\n"
  }
]