├── FILE_LICENSE
├── .gitignore
├── CTNetworking.xcodeproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
└── project.pbxproj
├── CTNetworking
├── ViewController.h
├── Demo
│ ├── DemoService
│ │ ├── DemoService.h
│ │ ├── Target_DemoService.h
│ │ ├── Target_DemoService.m
│ │ └── DemoService.m
│ ├── DemoControllers
│ │ └── DemoAPIManagerViewController
│ │ │ ├── DemoAPIManager
│ │ │ ├── DemoAPIManager.h
│ │ │ └── DemoAPIManager.m
│ │ │ ├── DemoAPIManagerViewController.h
│ │ │ └── DemoAPIManagerViewController.m
│ └── DemoAppContext
│ │ ├── Target_CTAppContext.h
│ │ └── Target_CTAppContext.m
├── AppDelegate.h
├── main.m
├── CTNetworking
│ ├── Categories
│ │ ├── Array
│ │ │ ├── NSArray+AXNetworkingMethods.h
│ │ │ └── NSArray+AXNetworkingMethods.m
│ │ ├── NSObject
│ │ │ ├── NSObject+AXNetworkingMethods.h
│ │ │ └── NSObject+AXNetworkingMethods.m
│ │ ├── String
│ │ │ ├── NSMutableString+AXNetworkingMethods.h
│ │ │ ├── NSString+AXNetworkingMethods.h
│ │ │ ├── NSMutableString+AXNetworkingMethods.m
│ │ │ └── NSString+AXNetworkingMethods.m
│ │ ├── Dictionary
│ │ │ ├── NSDictionary+AXNetworkingMethods.h
│ │ │ └── NSDictionary+AXNetworkingMethods.m
│ │ ├── CTMediator
│ │ │ └── AppContext
│ │ │ │ ├── CTMediator+CTAppContext.h
│ │ │ │ └── CTMediator+CTAppContext.m
│ │ └── NSURLRequest
│ │ │ ├── NSURLRequest+CTNetworkingMethods.h
│ │ │ └── NSURLRequest+CTNetworkingMethods.m
│ ├── Services
│ │ ├── CTServiceFactory.h
│ │ ├── CTServiceProtocol.h
│ │ └── CTServiceFactory.m
│ ├── CTNetworking.h
│ ├── Components
│ │ ├── CacheComponents
│ │ │ ├── DiskCacheDataCenter
│ │ │ │ ├── CTDiskCacheCenter.h
│ │ │ │ └── CTDiskCacheCenter.m
│ │ │ ├── MemCacheDataCenter
│ │ │ │ ├── CTMemoryCacheDataCenter.h
│ │ │ │ ├── MemoryCachedRecord
│ │ │ │ │ ├── CTMemoryCachedRecord.h
│ │ │ │ │ └── CTMemoryCachedRecord.m
│ │ │ │ └── CTMemoryCacheDataCenter.m
│ │ │ ├── CTCacheCenter.h
│ │ │ └── CTCacheCenter.m
│ │ ├── APIProxy
│ │ │ ├── CTApiProxy.h
│ │ │ └── CTApiProxy.m
│ │ ├── BaseAPITarget
│ │ │ └── H5API
│ │ │ │ ├── Target_H5API.h
│ │ │ │ └── Target_H5API.m
│ │ ├── LogComponents
│ │ │ ├── CTLogger.h
│ │ │ └── CTLogger.m
│ │ ├── URLResponse
│ │ │ ├── CTURLResponse.h
│ │ │ └── CTURLResponse.m
│ │ ├── iPhoneTypeDefine.plist
│ │ └── BaseAPIManager
│ │ │ ├── CTAPIBaseManager.h
│ │ │ └── CTAPIBaseManager.m
│ └── CTNetworkingDefines.h
├── Info.plist
├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── AppDelegate.m
└── ViewController.m
├── Podfile
├── readme.md
├── upload.sh
└── CTNetworking.podspec
/FILE_LICENSE:
--------------------------------------------------------------------------------
1 | MIT
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | CTNetworking.xcodeproj/xcuserdata/
2 | CTNetworking.xcworkspace/
3 | Pods/
4 | *.swp
5 | .DS_Store
6 | CTNetworking.xcodeproj/project.xcworkspace/xcuserdata/
7 | Podfile.lock
8 |
--------------------------------------------------------------------------------
/CTNetworking.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/CTNetworking/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // CTNetworking
4 | //
5 | // Created by casa on 2018/2/27.
6 | // Copyright © 2018年 casa. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/CTNetworking/Demo/DemoService/DemoService.h:
--------------------------------------------------------------------------------
1 | //
2 | // DemoService.h
3 | // CTNetworking
4 | //
5 | // Created by casa on 2018/2/27.
6 | // Copyright © 2018年 casa. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "CTNetworking.h"
11 |
12 | @interface DemoService : NSObject
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | platform :ios, '8.0'
3 |
4 | target 'CTNetworking' do
5 | # Uncomment this line if you're using Swift or would like to use dynamic frameworks
6 | # use_frameworks!
7 |
8 | pod "AFNetworking"
9 | pod "HandyFrame"
10 | pod "CTMediator"
11 |
12 |
13 | end
14 |
--------------------------------------------------------------------------------
/CTNetworking/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // CTNetworking
4 | //
5 | // Created by casa on 2018/2/27.
6 | // Copyright © 2018年 casa. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/CTNetworking/Demo/DemoControllers/DemoAPIManagerViewController/DemoAPIManager/DemoAPIManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // DemoAPIManager.h
3 | // CTNetworking
4 | //
5 | // Created by casa on 2018/2/27.
6 | // Copyright © 2018年 casa. All rights reserved.
7 | //
8 |
9 | #import "CTNetworking.h"
10 |
11 | @interface DemoAPIManager : CTAPIBaseManager
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/CTNetworking/Demo/DemoControllers/DemoAPIManagerViewController/DemoAPIManagerViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // DemoAPIManagerViewController.h
3 | // CTNetworking
4 | //
5 | // Created by casa on 2018/2/28.
6 | // Copyright © 2018年 casa. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface DemoAPIManagerViewController : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/CTNetworking/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // CTNetworking
4 | //
5 | // Created by casa on 2018/2/27.
6 | // Copyright © 2018年 casa. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Categories/Array/NSArray+AXNetworkingMethods.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSArray+AXNetworkingMethods.h
3 | // RTNetworking
4 | //
5 | // Created by casa on 14-5-13.
6 | // Copyright (c) 2014年 casatwy. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSArray (AXNetworkingMethods)
12 |
13 | - (NSString *)CT_paramsString;
14 | - (NSString *)CT_jsonString;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Categories/NSObject/NSObject+AXNetworkingMethods.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSObject+AXNetworkingMethods.h
3 | // RTNetworking
4 | //
5 | // Created by casa on 14-5-6.
6 | // Copyright (c) 2014年 casatwy. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSObject (AXNetworkingMethods)
12 |
13 | - (id)CT_defaultValue:(id)defaultData;
14 | - (BOOL)CT_isEmptyObject;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Categories/String/NSMutableString+AXNetworkingMethods.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSMutableString+AXNetworkingMethods.h
3 | // RTNetworking
4 | //
5 | // Created by casa on 14-5-17.
6 | // Copyright (c) 2014年 casatwy. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSMutableString (AXNetworkingMethods)
12 |
13 | - (void)appendURLRequest:(NSURLRequest *)request;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Categories/String/NSString+AXNetworkingMethods.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSString+AXNetworkingMethods.h
3 | // RTNetworking
4 | //
5 | // Created by casa on 14-5-6.
6 | // Copyright (c) 2014年 casatwy. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSString (AXNetworkingMethods)
12 |
13 | - (NSString *)CT_MD5;
14 | - (NSString *)CT_SHA1;
15 | - (NSString *)CT_Base64Encode;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Categories/Dictionary/NSDictionary+AXNetworkingMethods.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSDictionary+AXNetworkingMethods.h
3 | // RTNetworking
4 | //
5 | // Created by casa on 14-5-6.
6 | // Copyright (c) 2014年 casatwy. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSDictionary (AXNetworkingMethods)
12 |
13 | - (NSString *)CT_jsonString;
14 | - (NSString *)CT_transformToUrlParamString;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Services/CTServiceFactory.h:
--------------------------------------------------------------------------------
1 | //
2 | // AXServiceFactory.h
3 | // RTNetworking
4 | //
5 | // Created by casa on 14-5-12.
6 | // Copyright (c) 2014年 casatwy. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "CTServiceProtocol.h"
11 |
12 | @interface CTServiceFactory : NSObject
13 |
14 | + (instancetype)sharedInstance;
15 |
16 | - (id )serviceWithIdentifier:(NSString *)identifier;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/CTNetworking/Demo/DemoService/Target_DemoService.h:
--------------------------------------------------------------------------------
1 | //
2 | // Target_DemoService.h
3 | // CTNetworking
4 | //
5 | // Created by casa on 2018/2/27.
6 | // Copyright © 2018年 casa. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "DemoService.h"
11 |
12 | extern NSString * const CTNetworkingDemoServiceIdentifier;
13 |
14 | @interface Target_DemoService : NSObject
15 |
16 | - (DemoService *)Action_DemoService:(NSDictionary *)params;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/CTNetworking/Demo/DemoService/Target_DemoService.m:
--------------------------------------------------------------------------------
1 | //
2 | // Target_DemoService.m
3 | // CTNetworking
4 | //
5 | // Created by casa on 2018/2/27.
6 | // Copyright © 2018年 casa. All rights reserved.
7 | //
8 |
9 | #import "Target_DemoService.h"
10 |
11 | NSString * const CTNetworkingDemoServiceIdentifier = @"DemoService";
12 |
13 | @implementation Target_DemoService
14 |
15 | - (DemoService *)Action_DemoService:(NSDictionary *)params
16 | {
17 | return [[DemoService alloc] init];
18 | }
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/CTNetworking/Demo/DemoAppContext/Target_CTAppContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // Target_CTAppContext.h
3 | // CTNetworking
4 | //
5 | // Created by casa on 2018/2/27.
6 | // Copyright © 2018年 casa. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface Target_CTAppContext : NSObject
12 |
13 | - (BOOL)Action_shouldPrintNetworkingLog:(NSDictionary *)params;
14 | - (BOOL)Action_isReachable:(NSDictionary *)params;
15 | - (NSInteger)Action_cacheResponseCountLimit:(NSDictionary *)params;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/CTNetworking.h:
--------------------------------------------------------------------------------
1 | //
2 | // CTNetworking.h
3 | // CTNetworking
4 | //
5 | // Created by casa on 2018/2/27.
6 | // Copyright © 2018年 casa. All rights reserved.
7 | //
8 |
9 | #ifndef CTNetworking_h
10 | #define CTNetworking_h
11 |
12 | #import "CTServiceProtocol.h"
13 | #import "CTNetworkingDefines.h"
14 |
15 | #import "NSURLRequest+CTNetworkingMethods.h"
16 | #import "NSString+AXNetworkingMethods.h"
17 |
18 | #import "CTAPIBaseManager.h"
19 | #import "CTServiceFactory.h"
20 |
21 | #endif /* CTNetworking_h */
22 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Categories/CTMediator/AppContext/CTMediator+CTAppContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // CTMediator+CTAppContext.h
3 | // CTNetworking
4 | //
5 | // Created by casa on 2018/2/27.
6 | // Copyright © 2018年 casa. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface CTMediator (CTAppContext)
13 |
14 | - (BOOL)CTNetworking_shouldPrintNetworkingLog;
15 | - (BOOL)CTNetworking_isReachable;
16 | - (NSInteger)CTNetworking_cacheResponseCountLimit;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Components/CacheComponents/DiskCacheDataCenter/CTDiskCacheCenter.h:
--------------------------------------------------------------------------------
1 | //
2 | // CTDiskCacheCenter.h
3 | // BLNetworking
4 | //
5 | // Created by casa on 2016/11/21.
6 | // Copyright © 2016年 casa. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "CTURLResponse.h"
11 |
12 | @interface CTDiskCacheCenter : NSObject
13 |
14 | - (CTURLResponse *)fetchCachedRecordWithKey:(NSString *)key;
15 | - (void)saveCacheWithResponse:(CTURLResponse *)response key:(NSString *)key cacheTime:(NSTimeInterval)cacheTime;
16 | - (void)cleanAll;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Components/CacheComponents/MemCacheDataCenter/CTMemoryCacheDataCenter.h:
--------------------------------------------------------------------------------
1 | //
2 | // CTCache.h
3 | // RTNetworking
4 | //
5 | // Created by casa on 14-5-26.
6 | // Copyright (c) 2014年 casatwy. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "CTURLResponse.h"
11 |
12 | @interface CTMemoryCacheDataCenter : NSObject
13 |
14 | - (CTURLResponse *)fetchCachedRecordWithKey:(NSString *)key;
15 | - (void)saveCacheWithResponse:(CTURLResponse *)response key:(NSString *)key cacheTime:(NSTimeInterval)cacheTime;
16 | - (void)cleanAll;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Categories/NSURLRequest/NSURLRequest+CTNetworkingMethods.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSURLRequest+CTNetworkingMethods.h
3 | // RTNetworking
4 | //
5 | // Created by casa on 14-5-26.
6 | // Copyright (c) 2014年 casatwy. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "CTServiceProtocol.h"
11 |
12 | @interface NSURLRequest (CTNetworkingMethods)
13 |
14 | @property (nonatomic, copy) NSDictionary *actualRequestParams;
15 | @property (nonatomic, copy) NSDictionary *originRequestParams;
16 | @property (nonatomic, strong) id service;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/CTNetworking/Demo/DemoAppContext/Target_CTAppContext.m:
--------------------------------------------------------------------------------
1 | //
2 | // Target_CTAppContext.m
3 | // CTNetworking
4 | //
5 | // Created by casa on 2018/2/27.
6 | // Copyright © 2018年 casa. All rights reserved.
7 | //
8 |
9 | #import "Target_CTAppContext.h"
10 |
11 | @implementation Target_CTAppContext
12 |
13 | - (BOOL)Action_isReachable:(NSDictionary *)params
14 | {
15 | return YES;
16 | }
17 |
18 | - (BOOL)Action_shouldPrintNetworkingLog:(NSDictionary *)params
19 | {
20 | return YES;
21 | }
22 |
23 | - (NSInteger)Action_cacheResponseCountLimit:(NSDictionary *)params
24 | {
25 | return 2;
26 | }
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Components/APIProxy/CTApiProxy.h:
--------------------------------------------------------------------------------
1 | //
2 | // AXApiProxy.h
3 | // RTNetworking
4 | //
5 | // Created by casa on 14-5-12.
6 | // Copyright (c) 2014年 casatwy. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "CTURLResponse.h"
11 |
12 |
13 | typedef void(^CTCallback)(CTURLResponse *response);
14 |
15 | @interface CTApiProxy : NSObject
16 |
17 | + (instancetype)sharedInstance;
18 |
19 | - (NSNumber *)callApiWithRequest:(NSURLRequest *)request success:(CTCallback)success fail:(CTCallback)fail;
20 | - (void)cancelRequestWithRequestID:(NSNumber *)requestID;
21 | - (void)cancelRequestWithRequestIDList:(NSArray *)requestIDList;
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Components/BaseAPITarget/H5API/Target_H5API.h:
--------------------------------------------------------------------------------
1 | //
2 | // BLBaseAPITarget.h
3 | // BLNetworking
4 | //
5 | // Created by casa on 2017/1/18.
6 | // Copyright © 2017年 casa. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "CTAPIBaseManager.h"
11 |
12 | extern NSString * const kCTBaseAPITargetAPIContextDataKeyParamsForAPI;
13 | extern NSString * const kCTBaseAPITargetAPIContextDataKeyParamsAPIManager;
14 | extern NSString * const kCTBaseAPITargetAPIContextDataKeyOriginActionParams;
15 |
16 | @interface Target_H5API : NSObject
17 |
18 | - (id)Action_loadAPI:(NSDictionary *)params;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 |
2 | pod "CTNetworking"
3 |
4 | replacement for [RTNetworking](https://github.com/casatwy/RTNetworking)
5 |
6 | DEMO Projects
7 | ----------------
8 |
9 | [CTAPI_Marvel](https://github.com/CTAPIs/CTAPI_Marvel)
10 |
11 | - demos of `pagable api manager`, `param source`, `params in URL for GET`, `validator` see [CTAPI_Marvel](https://github.com/CTAPIs/CTAPI_Marvel)
12 |
13 | - `websocket call api`, `H5 call api` demo, see [CTJSBridge](https://github.com/casatwy/CTJSBridge)
14 |
15 | ---
16 |
17 | [CTAPI_AMap](https://github.com/CTAPIs/CTAPI_AMap)
18 |
19 | todo
20 | ----
21 |
22 | - group call api manager demo
23 | - dependented call api manager demo
24 | - memory cache demo
25 | - disk cache demo
26 | - auto login demo
27 | - reformer demo
28 | - swift call api demo
29 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Components/CacheComponents/MemCacheDataCenter/MemoryCachedRecord/CTMemoryCachedRecord.h:
--------------------------------------------------------------------------------
1 | //
2 | // CTCachedObject.h
3 | // RTNetworking
4 | //
5 | // Created by casa on 14-5-26.
6 | // Copyright (c) 2014年 casatwy. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface CTMemoryCachedRecord : NSObject
12 |
13 | @property (nonatomic, copy, readonly) NSData *content;
14 | @property (nonatomic, copy, readonly) NSDate *lastUpdateTime;
15 | @property (nonatomic, assign) NSTimeInterval cacheTime;
16 |
17 | @property (nonatomic, assign, readonly) BOOL isOutdated;
18 | @property (nonatomic, assign, readonly) BOOL isEmpty;
19 |
20 | - (instancetype)initWithContent:(NSData *)content;
21 | - (void)updateContent:(NSData *)content;
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/upload.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | VersionString=`grep -E 's.version.*=' CTNetworking.podspec`
4 | VersionNumber=`tr -cd 0-9 <<<"$VersionString"`
5 | NewVersionNumber=$(($VersionNumber + 1))
6 | LineNumber=`grep -nE 's.version.*=' CTNetworking.podspec | cut -d : -f1`
7 |
8 | git add .
9 | git commit -am modification
10 | git pull origin master --tags
11 |
12 | sed -i "" "${LineNumber}s/${VersionNumber}/${NewVersionNumber}/g" CTNetworking.podspec
13 |
14 | echo "current version is ${VersionNumber}, new version is ${NewVersionNumber}"
15 | say "current version is ${VersionNumber}, new version is ${NewVersionNumber}"
16 |
17 | git commit -am ${NewVersionNumber}
18 | git tag ${NewVersionNumber}
19 | git push origin master --tags
20 | pod trunk push ./CTNetworking.podspec --verbose --use-libraries --allow-warnings
21 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Components/LogComponents/CTLogger.h:
--------------------------------------------------------------------------------
1 | //
2 | // AXLogger.h
3 | // RTNetworking
4 | //
5 | // Created by casa on 14-5-6.
6 | // Copyright (c) 2014年 casatwy. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "CTServiceProtocol.h"
11 | #import "CTURLResponse.h"
12 |
13 |
14 | @interface CTLogger : NSObject
15 |
16 | + (NSString *)logDebugInfoWithRequest:(NSURLRequest *)request apiName:(NSString *)apiName service:(id )service;
17 | + (NSString *)logDebugInfoWithResponse:(NSHTTPURLResponse *)response responseObject:(id)responseObject responseString:(NSString *)responseString request:(NSURLRequest *)request error:(NSError *)error;
18 | + (NSString *)logDebugInfoWithCachedResponse:(CTURLResponse *)response methodName:(NSString *)methodName service:(id )service params:(NSDictionary *)params;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Categories/CTMediator/AppContext/CTMediator+CTAppContext.m:
--------------------------------------------------------------------------------
1 | //
2 | // CTMediator+CTAppContext.m
3 | // CTNetworking
4 | //
5 | // Created by casa on 2018/2/27.
6 | // Copyright © 2018年 casa. All rights reserved.
7 | //
8 |
9 | #import "CTMediator+CTAppContext.h"
10 |
11 | @implementation CTMediator (CTAppContext)
12 |
13 | - (BOOL)CTNetworking_shouldPrintNetworkingLog
14 | {
15 | return [[[CTMediator sharedInstance] performTarget:@"CTAppContext" action:@"shouldPrintNetworkingLog" params:nil shouldCacheTarget:YES] boolValue];
16 | }
17 |
18 | - (BOOL)CTNetworking_isReachable
19 | {
20 | return [[[CTMediator sharedInstance] performTarget:@"CTAppContext" action:@"isReachable" params:nil shouldCacheTarget:YES] boolValue];
21 | }
22 |
23 | - (NSInteger)CTNetworking_cacheResponseCountLimit
24 | {
25 | return [[[CTMediator sharedInstance] performTarget:@"CTAppContext" action:@"cacheResponseCountLimit" params:nil shouldCacheTarget:YES] integerValue];
26 | }
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Components/CacheComponents/CTCacheCenter.h:
--------------------------------------------------------------------------------
1 | //
2 | // CTCacheCenter.h
3 | // BLNetworking
4 | //
5 | // Created by casa on 2016/11/21.
6 | // Copyright © 2016年 casa. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "CTURLResponse.h"
11 |
12 | @interface CTCacheCenter : NSObject
13 |
14 | + (instancetype)sharedInstance;
15 |
16 | - (CTURLResponse *)fetchDiskCacheWithServiceIdentifier:(NSString *)serviceIdentifier methodName:(NSString *)methodName params:(NSDictionary *)params;
17 | - (CTURLResponse *)fetchMemoryCacheWithServiceIdentifier:(NSString *)serviceIdentifier methodName:(NSString *)methodName params:(NSDictionary *)params;
18 |
19 | - (void)saveDiskCacheWithResponse:(CTURLResponse *)response serviceIdentifier:(NSString *)serviceIdentifier methodName:(NSString *)methodName cacheTime:(NSTimeInterval)cacheTime;
20 | - (void)saveMemoryCacheWithResponse:(CTURLResponse *)response serviceIdentifier:(NSString *)serviceIdentifier methodName:(NSString *)methodName cacheTime:(NSTimeInterval)cacheTime;
21 |
22 | - (void)cleanAllMemoryCache;
23 | - (void)cleanAllDiskCache;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Categories/Array/NSArray+AXNetworkingMethods.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSArray+AXNetworkingMethods.m
3 | // RTNetworking
4 | //
5 | // Created by casa on 14-5-13.
6 | // Copyright (c) 2014年 casatwy. All rights reserved.
7 | //
8 |
9 | #import "NSArray+AXNetworkingMethods.h"
10 |
11 | @implementation NSArray (AXNetworkingMethods)
12 |
13 | /** 字母排序之后形成的参数字符串 */
14 | - (NSString *)CT_paramsString
15 | {
16 | NSMutableString *paramString = [[NSMutableString alloc] init];
17 |
18 | NSArray *sortedParams = [self sortedArrayUsingSelector:@selector(compare:)];
19 | [sortedParams enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
20 | if ([paramString length] == 0) {
21 | [paramString appendFormat:@"%@", obj];
22 | } else {
23 | [paramString appendFormat:@"&%@", obj];
24 | }
25 | }];
26 |
27 | return paramString;
28 | }
29 |
30 | /** 数组变json */
31 | - (NSString *)CT_jsonString
32 | {
33 | NSData *jsonData = [NSJSONSerialization dataWithJSONObject:self options:NSJSONWritingPrettyPrinted error:NULL];
34 | return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
35 | }
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Categories/Dictionary/NSDictionary+AXNetworkingMethods.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSDictionary+AXNetworkingMethods.m
3 | // RTNetworking
4 | //
5 | // Created by casa on 14-5-6.
6 | // Copyright (c) 2014年 casatwy. All rights reserved.
7 | //
8 |
9 | #import "NSDictionary+AXNetworkingMethods.h"
10 | #import "NSArray+AXNetworkingMethods.h"
11 |
12 | @implementation NSDictionary (AXNetworkingMethods)
13 |
14 | - (NSString *)CT_transformToUrlParamString
15 | {
16 | NSMutableString *paramString = [NSMutableString string];
17 | for (int i = 0; i < self.count; i ++) {
18 | NSString *string;
19 | if (i == 0) {
20 | string = [NSString stringWithFormat:@"?%@=%@", self.allKeys[i], self[self.allKeys[i]]];
21 | } else {
22 | string = [NSString stringWithFormat:@"&%@=%@", self.allKeys[i], self[self.allKeys[i]]];
23 | }
24 | [paramString appendString:string];
25 | }
26 | return paramString;
27 | }
28 |
29 | - (NSString *)CT_jsonString
30 | {
31 | NSData *jsonData = [NSJSONSerialization dataWithJSONObject:self options:NSJSONWritingPrettyPrinted error:NULL];
32 | return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
33 | }
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Components/CacheComponents/MemCacheDataCenter/MemoryCachedRecord/CTMemoryCachedRecord.m:
--------------------------------------------------------------------------------
1 | //
2 | // CTCachedObject.m
3 | // RTNetworking
4 | //
5 | // Created by casa on 14-5-26.
6 | // Copyright (c) 2014年 casatwy. All rights reserved.
7 | //
8 |
9 | #import "CTMemoryCachedRecord.h"
10 |
11 | @interface CTMemoryCachedRecord ()
12 |
13 | @property (nonatomic, copy, readwrite) NSData *content;
14 | @property (nonatomic, copy, readwrite) NSDate *lastUpdateTime;
15 |
16 | @end
17 |
18 | @implementation CTMemoryCachedRecord
19 |
20 | #pragma mark - getters and setters
21 | - (BOOL)isEmpty
22 | {
23 | return self.content == nil;
24 | }
25 |
26 | - (BOOL)isOutdated
27 | {
28 | NSTimeInterval timeInterval = [[NSDate date] timeIntervalSinceDate:self.lastUpdateTime];
29 | return timeInterval > self.cacheTime;
30 | }
31 |
32 | - (void)setContent:(NSData *)content
33 | {
34 | _content = [content copy];
35 | self.lastUpdateTime = [NSDate dateWithTimeIntervalSinceNow:0];
36 | }
37 |
38 | #pragma mark - life cycle
39 | - (instancetype)initWithContent:(NSData *)content
40 | {
41 | self = [super init];
42 | if (self) {
43 | self.content = content;
44 | }
45 | return self;
46 | }
47 |
48 | #pragma mark - public method
49 | - (void)updateContent:(NSData *)content
50 | {
51 | self.content = content;
52 | }
53 |
54 | @end
55 |
--------------------------------------------------------------------------------
/CTNetworking/Demo/DemoControllers/DemoAPIManagerViewController/DemoAPIManager/DemoAPIManager.m:
--------------------------------------------------------------------------------
1 | //
2 | // DemoAPIManager.m
3 | // CTNetworking
4 | //
5 | // Created by casa on 2018/2/27.
6 | // Copyright © 2018年 casa. All rights reserved.
7 | //
8 |
9 | #import "DemoAPIManager.h"
10 | #import "Target_DemoService.h"
11 |
12 | @interface DemoAPIManager ()
13 | @end
14 |
15 | @implementation DemoAPIManager
16 |
17 | #pragma mark - life cycle
18 | - (instancetype)init
19 | {
20 | self = [super init];
21 | if (self) {
22 | self.paramSource = self;
23 | self.validator = self;
24 | }
25 | return self;
26 | }
27 |
28 | #pragma mark - CTAPIManager
29 | - (NSString *_Nonnull)methodName
30 | {
31 | return @"public/characters";
32 | }
33 |
34 | - (NSString *_Nonnull)serviceIdentifier
35 | {
36 | return CTNetworkingDemoServiceIdentifier;
37 | }
38 |
39 | - (CTAPIManagerRequestType)requestType
40 | {
41 | return CTAPIManagerRequestTypeGet;
42 | }
43 |
44 | #pragma mark - CTAPIManagerParamSource
45 | - (NSDictionary *)paramsForApi:(CTAPIBaseManager *)manager
46 | {
47 | return nil;
48 | }
49 |
50 | #pragma mark - CTAPIManagerValidator
51 | - (CTAPIManagerErrorType)manager:(CTAPIBaseManager *)manager isCorrectWithParamsData:(NSDictionary *)data
52 | {
53 | return CTAPIManagerErrorTypeNoError;
54 | }
55 |
56 | - (CTAPIManagerErrorType)manager:(CTAPIBaseManager *)manager isCorrectWithCallBackData:(NSDictionary *)data
57 | {
58 | return CTAPIManagerErrorTypeNoError;
59 | }
60 |
61 | @end
62 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Services/CTServiceProtocol.h:
--------------------------------------------------------------------------------
1 | //
2 | // CTServiceProtocol.h
3 | // BLNetworking
4 | //
5 | // Created by user on 17/5/23.
6 | // Copyright © 2017年 casa. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "CTNetworkingDefines.h"
11 | #import
12 |
13 | @protocol CTServiceProtocol
14 |
15 | @property (nonatomic, assign)CTServiceAPIEnvironment apiEnvironment;
16 |
17 | - (NSURLRequest *)requestWithParams:(NSDictionary *)params
18 | methodName:(NSString *)methodName
19 | requestType:(CTAPIManagerRequestType)requestType;
20 |
21 | - (NSDictionary *)resultWithResponseObject:(id)responseObject
22 | response:(NSURLResponse *)response
23 | request:(NSURLRequest *)request
24 | error:(NSError **)error;
25 |
26 | /*
27 | return true means should continue the error handling process in CTAPIBaseManager
28 | return false means stop the error handling process
29 |
30 | 如果检查错误之后,需要继续走fail路径上报到业务层的,return YES。(例如网络错误等,需要业务层弹框)
31 | 如果检查错误之后,不需要继续走fail路径上报到业务层的,return NO。(例如用户token失效,此时挂起API,调用刷新token的API,成功之后再重新调用原来的API。那么这种情况就不需要继续走fail路径上报到业务。)
32 | */
33 | - (BOOL)handleCommonErrorWithResponse:(CTURLResponse *)response
34 | manager:(CTAPIBaseManager *)manager
35 | errorType:(CTAPIManagerErrorType)errorType;
36 |
37 | @optional
38 | - (AFHTTPSessionManager *)sessionManager;
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/CTNetworking/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Categories/NSURLRequest/NSURLRequest+CTNetworkingMethods.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSURLRequest+CTNetworkingMethods.m
3 | // RTNetworking
4 | //
5 | // Created by casa on 14-5-26.
6 | // Copyright (c) 2014年 casatwy. All rights reserved.
7 | //
8 |
9 | #import "NSURLRequest+CTNetworkingMethods.h"
10 | #import
11 |
12 | static void *CTNetworkingActualRequestParams = &CTNetworkingActualRequestParams;
13 | static void *CTNetworkingOriginRequestParams = &CTNetworkingOriginRequestParams;
14 | static void *CTNetworkingRequestService = &CTNetworkingRequestService;
15 |
16 | @implementation NSURLRequest (CTNetworkingMethods)
17 |
18 | - (void)setActualRequestParams:(NSDictionary *)actualRequestParams
19 | {
20 | objc_setAssociatedObject(self, CTNetworkingActualRequestParams, actualRequestParams, OBJC_ASSOCIATION_COPY);
21 | }
22 |
23 | - (NSDictionary *)actualRequestParams
24 | {
25 | return objc_getAssociatedObject(self, CTNetworkingActualRequestParams);
26 | }
27 |
28 | - (void)setOriginRequestParams:(NSDictionary *)originRequestParams
29 | {
30 | objc_setAssociatedObject(self, CTNetworkingOriginRequestParams, originRequestParams, OBJC_ASSOCIATION_COPY);
31 | }
32 |
33 | - (NSDictionary *)originRequestParams
34 | {
35 | return objc_getAssociatedObject(self, CTNetworkingOriginRequestParams);
36 | }
37 |
38 | - (void)setService:(id)service
39 | {
40 | objc_setAssociatedObject(self, CTNetworkingRequestService, service, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
41 | }
42 |
43 | - (id)service
44 | {
45 | return objc_getAssociatedObject(self, CTNetworkingRequestService);
46 | }
47 |
48 | @end
49 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Components/URLResponse/CTURLResponse.h:
--------------------------------------------------------------------------------
1 | //
2 | // AXURLResponse.h
3 | // RTNetworking
4 | //
5 | // Created by casa on 14-5-18.
6 | // Copyright (c) 2014年 casatwy. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef NS_ENUM(NSUInteger, CTURLResponseStatus)
12 | {
13 | CTURLResponseStatusSuccess, //作为底层,请求是否成功只考虑是否成功收到服务器反馈。至于签名是否正确,返回的数据是否完整,由上层的CTAPIBaseManager来决定。
14 | CTURLResponseStatusErrorTimeout,
15 | CTURLResponseStatusErrorCancel,
16 | CTURLResponseStatusErrorNoNetwork // 默认除了超时以外的错误都是无网络错误。
17 | };
18 |
19 | @interface CTURLResponse : NSObject
20 |
21 | @property (nonatomic, assign, readonly) CTURLResponseStatus status;
22 | @property (nonatomic, copy, readonly) NSString *contentString;
23 | @property (nonatomic, copy, readonly) id content;
24 | @property (nonatomic, assign, readonly) NSInteger requestId;
25 | @property (nonatomic, copy, readonly) NSURLRequest *request;
26 | @property (nonatomic, copy, readonly) NSData *responseData;
27 | @property (nonatomic, strong, readonly) NSString *errorMessage;
28 |
29 | @property (nonatomic, copy) NSDictionary *acturlRequestParams;
30 | @property (nonatomic, copy) NSDictionary *originRequestParams;
31 | @property (nonatomic, strong) NSString *logString;
32 |
33 | @property (nonatomic, assign, readonly) BOOL isCache;
34 |
35 | - (instancetype)initWithResponseString:(NSString *)responseString requestId:(NSNumber *)requestId request:(NSURLRequest *)request responseObject:(id)responseObject error:(NSError *)error;
36 |
37 | // 使用initWithData的response,它的isCache是YES,上面两个函数生成的response的isCache是NO
38 | - (instancetype)initWithData:(NSData *)data;
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Services/CTServiceFactory.m:
--------------------------------------------------------------------------------
1 | //
2 | // AXServiceFactory.m
3 | // RTNetworking
4 | //
5 | // Created by casa on 14-5-12.
6 | // Copyright (c) 2014年 casatwy. All rights reserved.
7 | //
8 |
9 | #import "CTServiceFactory.h"
10 | #import
11 |
12 | /*************************************************************************/
13 |
14 | @interface CTServiceFactory ()
15 |
16 | @property (nonatomic, strong) NSMutableDictionary *serviceStorage;
17 |
18 | @end
19 |
20 | @implementation CTServiceFactory
21 |
22 | #pragma mark - getters and setters
23 | - (NSMutableDictionary *)serviceStorage
24 | {
25 | if (_serviceStorage == nil) {
26 | _serviceStorage = [[NSMutableDictionary alloc] init];
27 | }
28 | return _serviceStorage;
29 | }
30 |
31 | #pragma mark - life cycle
32 | + (instancetype)sharedInstance
33 | {
34 | static dispatch_once_t onceToken;
35 | static CTServiceFactory *sharedInstance;
36 | dispatch_once(&onceToken, ^{
37 | sharedInstance = [[CTServiceFactory alloc] init];
38 | });
39 | return sharedInstance;
40 | }
41 |
42 | #pragma mark - public methods
43 | - (id )serviceWithIdentifier:(NSString *)identifier
44 | {
45 | if (self.serviceStorage[identifier] == nil) {
46 | self.serviceStorage[identifier] = [self newServiceWithIdentifier:identifier];
47 | }
48 | return self.serviceStorage[identifier];
49 | }
50 |
51 | #pragma mark - private methods
52 | - (id )newServiceWithIdentifier:(NSString *)identifier
53 | {
54 | return [[CTMediator sharedInstance] performTarget:identifier action:identifier params:nil shouldCacheTarget:NO];
55 | }
56 |
57 | @end
58 |
--------------------------------------------------------------------------------
/CTNetworking/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Categories/NSObject/NSObject+AXNetworkingMethods.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSObject+AXNetworkingMethods.m
3 | // RTNetworking
4 | //
5 | // Created by casa on 14-5-6.
6 | // Copyright (c) 2014年 casatwy. All rights reserved.
7 | //
8 |
9 | #import "NSObject+AXNetworkingMethods.h"
10 |
11 | @implementation NSObject (AXNetworkingMethods)
12 |
13 | - (id)CT_defaultValue:(id)defaultData
14 | {
15 | BOOL shouldContinue = NO;
16 | if ([self isKindOfClass:[NSString class]] || [self isKindOfClass:NSClassFromString(@"NSTaggedPointerString")] || [self isKindOfClass:NSClassFromString(@"__NSCFConstantString")]) {
17 | if ([defaultData isKindOfClass:[NSString class]] || [defaultData isKindOfClass:NSClassFromString(@"NSTaggedPointerString")] || [defaultData isKindOfClass:NSClassFromString(@"__NSCFConstantString")]) {
18 | shouldContinue = YES;
19 | }
20 | } else if (![defaultData isMemberOfClass:[self class]]) {
21 | return defaultData;
22 | }
23 |
24 | if (shouldContinue == NO) {
25 | return [NSString stringWithFormat:@"%@", defaultData];
26 | }
27 |
28 | if ([self CT_isEmptyObject]) {
29 | return defaultData;
30 | }
31 |
32 | return self;
33 | }
34 |
35 | - (BOOL)CT_isEmptyObject
36 | {
37 | if ([self isEqual:[NSNull null]]) {
38 | return YES;
39 | }
40 |
41 | if ([self isKindOfClass:[NSString class]]) {
42 | if ([(NSString *)self length] == 0) {
43 | return YES;
44 | }
45 | }
46 |
47 | if ([self isKindOfClass:[NSArray class]]) {
48 | if ([(NSArray *)self count] == 0) {
49 | return YES;
50 | }
51 | }
52 |
53 | if ([self isKindOfClass:[NSDictionary class]]) {
54 | if ([(NSDictionary *)self count] == 0) {
55 | return YES;
56 | }
57 | }
58 |
59 | return NO;
60 | }
61 |
62 | @end
63 |
--------------------------------------------------------------------------------
/CTNetworking/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "60x60",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "size" : "60x60",
41 | "scale" : "3x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "20x20",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "20x20",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "29x29",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "29x29",
61 | "scale" : "2x"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "size" : "40x40",
66 | "scale" : "1x"
67 | },
68 | {
69 | "idiom" : "ipad",
70 | "size" : "40x40",
71 | "scale" : "2x"
72 | },
73 | {
74 | "idiom" : "ipad",
75 | "size" : "76x76",
76 | "scale" : "1x"
77 | },
78 | {
79 | "idiom" : "ipad",
80 | "size" : "76x76",
81 | "scale" : "2x"
82 | },
83 | {
84 | "idiom" : "ipad",
85 | "size" : "83.5x83.5",
86 | "scale" : "2x"
87 | }
88 | ],
89 | "info" : {
90 | "version" : 1,
91 | "author" : "xcode"
92 | }
93 | }
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Components/CacheComponents/MemCacheDataCenter/CTMemoryCacheDataCenter.m:
--------------------------------------------------------------------------------
1 | //
2 | // CTCache.m
3 | // RTNetworking
4 | //
5 | // Created by casa on 14-5-26.
6 | // Copyright (c) 2014年 casatwy. All rights reserved.
7 | //
8 |
9 | #import "CTMemoryCacheDataCenter.h"
10 | #import "CTMemoryCachedRecord.h"
11 | #import "CTMediator+CTAppContext.h"
12 |
13 | @interface CTMemoryCacheDataCenter ()
14 |
15 | @property (nonatomic, strong) NSCache *cache;
16 |
17 | @end
18 |
19 | @implementation CTMemoryCacheDataCenter
20 |
21 | #pragma mark - public method
22 | - (CTURLResponse *)fetchCachedRecordWithKey:(NSString *)key
23 | {
24 | CTURLResponse *result = nil;
25 | CTMemoryCachedRecord *cachedRecord = [self.cache objectForKey:key];
26 | if (cachedRecord != nil) {
27 | if (cachedRecord.isOutdated || cachedRecord.isEmpty) {
28 | [self.cache removeObjectForKey:key];
29 | } else {
30 | result = [[CTURLResponse alloc] initWithData:cachedRecord.content];
31 | }
32 | }
33 | return result;
34 | }
35 |
36 | - (void)saveCacheWithResponse:(CTURLResponse *)response key:(NSString *)key cacheTime:(NSTimeInterval)cacheTime
37 | {
38 | CTMemoryCachedRecord *cachedRecord = [self.cache objectForKey:key];
39 | if (cachedRecord == nil) {
40 | cachedRecord = [[CTMemoryCachedRecord alloc] init];
41 | }
42 | cachedRecord.cacheTime = cacheTime;
43 | [cachedRecord updateContent:[NSJSONSerialization dataWithJSONObject:response.content options:0 error:NULL]];
44 | [self.cache setObject:cachedRecord forKey:key];
45 | }
46 |
47 | - (void)cleanAll
48 | {
49 | [self.cache removeAllObjects];
50 | }
51 |
52 | #pragma mark - getters and setters
53 | - (NSCache *)cache
54 | {
55 | if (_cache == nil) {
56 | _cache = [[NSCache alloc] init];
57 | _cache.countLimit = [[CTMediator sharedInstance] CTNetworking_cacheResponseCountLimit];
58 | }
59 | return _cache;
60 | }
61 |
62 | @end
63 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Categories/String/NSMutableString+AXNetworkingMethods.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSMutableString+AXNetworkingMethods.m
3 | // RTNetworking
4 | //
5 | // Created by casa on 14-5-17.
6 | // Copyright (c) 2014年 casatwy. All rights reserved.
7 | //
8 |
9 | #import "NSMutableString+AXNetworkingMethods.h"
10 | #import "NSObject+AXNetworkingMethods.h"
11 | #import "NSURLRequest+CTNetworkingMethods.h"
12 | #import "NSDictionary+AXNetworkingMethods.h"
13 |
14 | @implementation NSMutableString (AXNetworkingMethods)
15 |
16 | - (void)appendURLRequest:(NSURLRequest *)request
17 | {
18 | [self appendFormat:@"\n\nHTTP URL:\n\t%@", request.URL];
19 | [self appendFormat:@"\n\nHTTP Header:\n%@", request.allHTTPHeaderFields ? request.allHTTPHeaderFields : @"\t\t\t\t\tN/A"];
20 | [self appendFormat:@"\n\nHTTP Origin Params:\n\t%@", request.originRequestParams.CT_jsonString];
21 | [self appendFormat:@"\n\nHTTP Actual Params:\n\t%@", request.actualRequestParams.CT_jsonString];
22 | [self appendFormat:@"\n\nHTTP Body:\n\t%@", [[[NSString alloc] initWithData:request.HTTPBody encoding:NSUTF8StringEncoding] CT_defaultValue:@"\t\t\t\tN/A"]];
23 |
24 | NSMutableString *headerString = [[NSMutableString alloc] init];
25 | [request.allHTTPHeaderFields enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSString * _Nonnull obj, BOOL * _Nonnull stop) {
26 | NSString *header = [NSString stringWithFormat:@" -H \"%@: %@\"", key, obj];
27 | [headerString appendString:header];
28 | }];
29 |
30 | [self appendString:@"\n\nCURL:\n\t curl"];
31 | [self appendFormat:@" -X %@", request.HTTPMethod];
32 |
33 | if (headerString.length > 0) {
34 | [self appendString:headerString];
35 | }
36 | if (request.HTTPBody.length > 0) {
37 | [self appendFormat:@" -d '%@'", [[[NSString alloc] initWithData:request.HTTPBody encoding:NSUTF8StringEncoding] CT_defaultValue:@"\t\t\t\tN/A"]];
38 | }
39 |
40 | [self appendFormat:@" %@", request.URL];
41 | }
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/CTNetworking/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // CTNetworking
4 | //
5 | // Created by casa on 2018/2/27.
6 | // Copyright © 2018年 casa. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 |
11 | @interface AppDelegate ()
12 |
13 | @end
14 |
15 | @implementation AppDelegate
16 |
17 |
18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
19 | // Override point for customization after application launch.
20 | return YES;
21 | }
22 |
23 |
24 | - (void)applicationWillResignActive:(UIApplication *)application {
25 | // 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.
26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
27 | }
28 |
29 |
30 | - (void)applicationDidEnterBackground:(UIApplication *)application {
31 | // 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.
32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
33 | }
34 |
35 |
36 | - (void)applicationWillEnterForeground:(UIApplication *)application {
37 | // 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.
38 | }
39 |
40 |
41 | - (void)applicationDidBecomeActive:(UIApplication *)application {
42 | // 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.
43 | }
44 |
45 |
46 | - (void)applicationWillTerminate:(UIApplication *)application {
47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
48 | }
49 |
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Components/iPhoneTypeDefine.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | i386
6 | 32-bit Simulator
7 | x86_64
8 | 64-bit Simulator
9 | iPod1,1
10 | iPod Touch
11 | iPod2,1
12 | iPod Touch Second Generation
13 | iPod3,1
14 | iPod Touch Third Generation
15 | iPod4,1
16 | iPod Touch Fourth Generation
17 | iPhone1,1
18 | iPhone
19 | iPhone1,2
20 | iPhone 3G
21 | iPhone2,1
22 | iPhone 3GS
23 | iPad1,1
24 | iPad
25 | iPad2,1
26 | iPad 2
27 | iPad3,1
28 | 3rd Generation iPad
29 | iPhone3,1
30 | iPhone 4 (GSM)
31 | iPhone3,3
32 | iPhone 4 (CDMA/Verizon/Sprint)
33 | iPhone4,1
34 | iPhone 4S
35 | iPhone5,1
36 | iPhone 5 (model A1428, AT&T/Canada)
37 | iPhone5,2
38 | iPhone 5 (model A1429, everything else)
39 | iPad3,4
40 | 4th Generation iPad
41 | iPad2,5
42 | iPad Mini
43 | iPhone5,3
44 | iPhone 5c (model A1456, A1532 | GSM)
45 | iPhone5,4
46 | iPhone 5c (model A1507, A1516, A1526 (China), A1529 | Global)
47 | iPhone6,1
48 | iPhone 5s (model A1433, A1533 | GSM)
49 | iPhone6,2
50 | iPhone 5s (model A1457, A1518, A1528 (China), A1530 | Global)
51 | iPad4,1
52 | 5th Generation iPad (iPad Air) - Wifi
53 | iPad4,2
54 | 5th Generation iPad (iPad Air) - Cellular
55 | iPad4,4
56 | 2nd Generation iPad Mini - Wifi
57 | iPad4,5
58 | 2nd Generation iPad Mini - Cellular
59 | iPhone7,1
60 | iPhone 6 Plus
61 | iPhone7,2
62 | iPhone 6
63 |
64 |
65 |
--------------------------------------------------------------------------------
/CTNetworking/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // CTNetworking
4 | //
5 | // Created by casa on 2018/2/27.
6 | // Copyright © 2018年 casa. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 | #import
11 | #import "DemoAPIManagerViewController.h"
12 |
13 | @interface ViewController ()
14 |
15 | @property (nonatomic, strong) UITableView *tableView;
16 | @property (nonatomic, strong) NSArray *dataSource;
17 |
18 | @end
19 |
20 | @implementation ViewController
21 |
22 | #pragma mark - life cycle
23 | - (void)viewDidLoad
24 | {
25 | [super viewDidLoad];
26 | [self.view addSubview:self.tableView];
27 | }
28 |
29 | - (void)viewWillLayoutSubviews
30 | {
31 | [super viewWillLayoutSubviews];
32 | [self.tableView fill];
33 | }
34 |
35 | #pragma mark - UITableViewDataSource
36 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
37 | {
38 | return self.dataSource.count;
39 | }
40 |
41 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
42 | {
43 | return [tableView dequeueReusableCellWithIdentifier:@"cell"];
44 | }
45 |
46 | #pragma mark - UITableViewDelegate
47 | - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
48 | {
49 | cell.textLabel.text = self.dataSource[indexPath.row];
50 | }
51 |
52 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
53 | {
54 | if (indexPath.row == 0) {
55 | DemoAPIManagerViewController *viewController = [[DemoAPIManagerViewController alloc] init];
56 | [self.navigationController pushViewController:viewController animated:YES];
57 | }
58 | }
59 |
60 | #pragma mark - getters and setters
61 | - (UITableView *)tableView
62 | {
63 | if (_tableView == nil) {
64 | _tableView = [[UITableView alloc] init];
65 | _tableView.delegate = self;
66 | _tableView.dataSource = self;
67 | [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
68 | }
69 | return _tableView;
70 | }
71 |
72 | - (NSArray *)dataSource
73 | {
74 | if (_dataSource == nil) {
75 | _dataSource = @[@"call DemoAPIManager"];
76 | }
77 | return _dataSource;
78 | }
79 |
80 | @end
81 |
--------------------------------------------------------------------------------
/CTNetworking/Demo/DemoControllers/DemoAPIManagerViewController/DemoAPIManagerViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // DemoAPIManagerViewController.m
3 | // CTNetworking
4 | //
5 | // Created by casa on 2018/2/28.
6 | // Copyright © 2018年 casa. All rights reserved.
7 | //
8 |
9 | #import "DemoAPIManagerViewController.h"
10 | #import "CTNetworking.h"
11 | #import "DemoAPIManager.h"
12 | #import
13 |
14 | @interface DemoAPIManagerViewController ()
15 |
16 | @property (nonatomic, strong) UIButton *startRequestButton;
17 | @property (nonatomic, strong) DemoAPIManager *demoAPIManager;
18 |
19 | @end
20 |
21 | @implementation DemoAPIManagerViewController
22 |
23 | #pragma mark - life cycle
24 | - (void)viewDidLoad {
25 | [super viewDidLoad];
26 | self.view.backgroundColor = [UIColor whiteColor];
27 | [self.view addSubview:self.startRequestButton];
28 | }
29 |
30 | - (void)viewWillLayoutSubviews
31 | {
32 | [super viewWillLayoutSubviews];
33 |
34 | [self.startRequestButton sizeToFit];
35 | [self.startRequestButton centerEqualToView:self.view];
36 | }
37 |
38 | #pragma mark - CTAPIManagerCallBackDelegate
39 | - (void)managerCallAPIDidSuccess:(CTAPIBaseManager *)manager
40 | {
41 | NSLog(@"%@", [manager fetchDataWithReformer:nil]);
42 | }
43 |
44 | - (void)managerCallAPIDidFailed:(CTAPIBaseManager *)manager
45 | {
46 | NSLog(@"%@", [manager fetchDataWithReformer:nil]);
47 | }
48 |
49 | #pragma mark - event response
50 | - (void)didTappedStartButton:(UIButton *)startButton
51 | {
52 | [self.demoAPIManager loadData];
53 | }
54 |
55 | #pragma mark - getters and setters
56 | - (DemoAPIManager *)demoAPIManager
57 | {
58 | if (_demoAPIManager == nil) {
59 | _demoAPIManager = [[DemoAPIManager alloc] init];
60 | _demoAPIManager.delegate = self;
61 | }
62 | return _demoAPIManager;
63 | }
64 |
65 | - (UIButton *)startRequestButton
66 | {
67 | if (_startRequestButton == nil) {
68 | _startRequestButton = [UIButton buttonWithType:UIButtonTypeCustom];
69 | [_startRequestButton setTitle:@"send request" forState:UIControlStateNormal];
70 | [_startRequestButton setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
71 | [_startRequestButton addTarget:self action:@selector(didTappedStartButton:) forControlEvents:UIControlEventTouchUpInside];
72 | }
73 | return _startRequestButton;
74 | }
75 |
76 | @end
77 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Components/BaseAPIManager/CTAPIBaseManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // AJKBaseManager.h
3 | // casatwy2
4 | //
5 | // Created by casa on 13-12-2.
6 | // Copyright (c) 2013年 casatwy inc. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "CTURLResponse.h"
11 | #import "CTNetworkingDefines.h"
12 |
13 | @interface CTAPIBaseManager : NSObject
14 |
15 | // outter functions
16 | @property (nonatomic, weak) id _Nullable delegate;
17 | @property (nonatomic, weak) id _Nullable paramSource;
18 | @property (nonatomic, weak) id _Nullable validator;
19 | @property (nonatomic, weak) NSObject * _Nullable child; //里面会调用到NSObject的方法,所以这里不用id
20 | @property (nonatomic, weak) id _Nullable interceptor;
21 |
22 | // cache
23 | @property (nonatomic, assign) CTAPIManagerCachePolicy cachePolicy;
24 | @property (nonatomic, assign) NSTimeInterval memoryCacheSecond; // 默认 3 * 60
25 | @property (nonatomic, assign) NSTimeInterval diskCacheSecond; // 默认 3 * 60
26 | @property (nonatomic, assign) BOOL shouldIgnoreCache; //默认NO
27 |
28 | // response
29 | @property (nonatomic, strong) CTURLResponse * _Nonnull response;
30 | @property (nonatomic, readonly) CTAPIManagerErrorType errorType;
31 | @property (nonatomic, copy, readonly) NSString * _Nullable errorMessage;
32 |
33 | // before loading
34 | @property (nonatomic, assign, readonly) BOOL isReachable;
35 | @property (nonatomic, assign, readonly) BOOL isLoading;
36 |
37 | // start
38 | - (NSInteger)loadData;
39 | + (NSInteger)loadDataWithParams:(NSDictionary * _Nullable)params success:(void (^ _Nullable)(CTAPIBaseManager * _Nonnull apiManager))successCallback fail:(void (^ _Nullable)(CTAPIBaseManager * _Nonnull apiManager))failCallback;
40 |
41 | // cancel
42 | - (void)cancelAllRequests;
43 | - (void)cancelRequestWithRequestId:(NSInteger)requestID;
44 |
45 | // finish
46 | - (id _Nullable )fetchDataWithReformer:(id _Nullable)reformer;
47 | - (void)cleanData;
48 |
49 | @end
50 |
51 | @interface CTAPIBaseManager (InnerInterceptor)
52 |
53 | - (BOOL)beforePerformSuccessWithResponse:(CTURLResponse *_Nullable)response;
54 | - (void)afterPerformSuccessWithResponse:(CTURLResponse *_Nullable)response;
55 |
56 | - (BOOL)beforePerformFailWithResponse:(CTURLResponse *_Nullable)response;
57 | - (void)afterPerformFailWithResponse:(CTURLResponse *_Nullable)response;
58 |
59 | - (BOOL)shouldCallAPIWithParams:(NSDictionary *_Nullable)params;
60 | - (void)afterCallingAPIWithParams:(NSDictionary *_Nullable)params;
61 |
62 | @end
63 |
64 |
--------------------------------------------------------------------------------
/CTNetworking/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Components/CacheComponents/DiskCacheDataCenter/CTDiskCacheCenter.m:
--------------------------------------------------------------------------------
1 | //
2 | // CTDiskCacheCenter.m
3 | // BLNetworking
4 | //
5 | // Created by casa on 2016/11/21.
6 | // Copyright © 2016年 casa. All rights reserved.
7 | //
8 |
9 | #import "CTDiskCacheCenter.h"
10 |
11 | NSString * const kCTDiskCacheCenterCachedObjectKeyPrefix = @"kCTDiskCacheCenterCachedObjectKeyPrefix";
12 |
13 | @implementation CTDiskCacheCenter
14 |
15 | - (CTURLResponse *)fetchCachedRecordWithKey:(NSString *)key
16 | {
17 | NSString *actualKey = [NSString stringWithFormat:@"%@%@",kCTDiskCacheCenterCachedObjectKeyPrefix, key];
18 | CTURLResponse *response = nil;
19 | NSData *data = [[NSUserDefaults standardUserDefaults] dataForKey:actualKey];
20 | if (data) {
21 | NSDictionary *fetchedContent = [NSJSONSerialization JSONObjectWithData:data options:0 error:NULL];
22 | NSNumber *lastUpdateTimeNumber = fetchedContent[@"lastUpdateTime"];
23 | NSDate *lastUpdateTime = [NSDate dateWithTimeIntervalSince1970:lastUpdateTimeNumber.doubleValue];
24 | NSTimeInterval timeInterval = [[NSDate date] timeIntervalSinceDate:lastUpdateTime];
25 | if (timeInterval < [fetchedContent[@"cacheTime"] doubleValue]) {
26 | response = [[CTURLResponse alloc] initWithData:[NSJSONSerialization dataWithJSONObject:fetchedContent[@"content"] options:0 error:NULL]];
27 | } else {
28 | [[NSUserDefaults standardUserDefaults] removeObjectForKey:actualKey];
29 | [[NSUserDefaults standardUserDefaults] synchronize];
30 | }
31 | }
32 | return response;
33 | }
34 |
35 | - (void)saveCacheWithResponse:(CTURLResponse *)response key:(NSString *)key cacheTime:(NSTimeInterval)cacheTime
36 | {
37 | if (response.content) {
38 | NSData *data = [NSJSONSerialization dataWithJSONObject:@{
39 | @"content":response.content,
40 | @"lastUpdateTime":@([NSDate date].timeIntervalSince1970),
41 | @"cacheTime":@(cacheTime)
42 | }
43 | options:0
44 | error:NULL];
45 | if (data) {
46 | NSString *actualKey = [NSString stringWithFormat:@"%@%@",kCTDiskCacheCenterCachedObjectKeyPrefix, key];
47 | [[NSUserDefaults standardUserDefaults] setObject:data forKey:actualKey];
48 | [[NSUserDefaults standardUserDefaults] synchronize];
49 | }
50 | }
51 | }
52 |
53 | - (void)cleanAll
54 | {
55 | NSDictionary *defaultsDict = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
56 | NSArray *keys = [[defaultsDict allKeys] filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF beginswith[c] %@", kCTDiskCacheCenterCachedObjectKeyPrefix]];
57 | for(NSString *key in keys) {
58 | [[NSUserDefaults standardUserDefaults] removeObjectForKey:key];
59 | }
60 | [[NSUserDefaults standardUserDefaults] synchronize];
61 | }
62 |
63 | @end
64 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Components/URLResponse/CTURLResponse.m:
--------------------------------------------------------------------------------
1 | //
2 | // AXURLResponse.m
3 | // RTNetworking
4 | //
5 | // Created by casa on 14-5-18.
6 | // Copyright (c) 2014年 casatwy. All rights reserved.
7 | //
8 |
9 | #import "CTURLResponse.h"
10 | #import "NSObject+AXNetworkingMethods.h"
11 | #import "NSURLRequest+CTNetworkingMethods.h"
12 |
13 | @interface CTURLResponse ()
14 |
15 | @property (nonatomic, assign, readwrite) CTURLResponseStatus status;
16 | @property (nonatomic, copy, readwrite) NSString *contentString;
17 | @property (nonatomic, copy, readwrite) id content;
18 | @property (nonatomic, copy, readwrite) NSURLRequest *request;
19 | @property (nonatomic, assign, readwrite) NSInteger requestId;
20 | @property (nonatomic, copy, readwrite) NSData *responseData;
21 | @property (nonatomic, assign, readwrite) BOOL isCache;
22 | @property (nonatomic, strong, readwrite) NSString *errorMessage;
23 |
24 | @end
25 |
26 | @implementation CTURLResponse
27 |
28 | #pragma mark - life cycle
29 | - (instancetype)initWithResponseString:(NSString *)responseString requestId:(NSNumber *)requestId request:(NSURLRequest *)request responseObject:(NSDictionary *)responseObject error:(NSError *)error
30 | {
31 | self = [super init];
32 | if (self) {
33 | self.contentString = [responseString CT_defaultValue:@""];
34 | self.requestId = [requestId integerValue];
35 | self.request = request;
36 | self.acturlRequestParams = request.actualRequestParams;
37 | self.originRequestParams = request.originRequestParams;
38 | self.isCache = NO;
39 | self.status = [self responseStatusWithError:error];
40 | self.content = responseObject ? responseObject : @{};
41 | self.errorMessage = [NSString stringWithFormat:@"%@", error];
42 | }
43 | return self;
44 | }
45 |
46 | - (instancetype)initWithData:(NSData *)data
47 | {
48 | self = [super init];
49 | if (self) {
50 | self.contentString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
51 | self.status = [self responseStatusWithError:nil];
52 | self.requestId = 0;
53 | self.request = nil;
54 | self.responseData = data;
55 | self.content = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:NULL];
56 | self.isCache = YES;
57 | }
58 | return self;
59 | }
60 |
61 | #pragma mark - private methods
62 | - (CTURLResponseStatus)responseStatusWithError:(NSError *)error
63 | {
64 | if (error) {
65 | CTURLResponseStatus result = CTURLResponseStatusErrorNoNetwork;
66 |
67 | // 除了超时以外,所有错误都当成是无网络
68 | if (error.code == NSURLErrorTimedOut) {
69 | result = CTURLResponseStatusErrorTimeout;
70 | }
71 | if (error.code == NSURLErrorCancelled) {
72 | result = CTURLResponseStatusErrorCancel;
73 | }
74 | if (error.code == NSURLErrorNotConnectedToInternet) {
75 | result = CTURLResponseStatusErrorNoNetwork;
76 | }
77 | return result;
78 | } else {
79 | return CTURLResponseStatusSuccess;
80 | }
81 | }
82 |
83 | #pragma mark - getters and setters
84 | - (NSData *)responseData
85 | {
86 | if (_responseData == nil) {
87 | NSError *error = nil;
88 | _responseData = [NSJSONSerialization dataWithJSONObject:self.content options:0 error:&error];
89 | if (error) {
90 | _responseData = [@"" dataUsingEncoding:NSUTF8StringEncoding];
91 | }
92 | }
93 | return _responseData;
94 | }
95 |
96 | @end
97 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Components/CacheComponents/CTCacheCenter.m:
--------------------------------------------------------------------------------
1 | //
2 | // CTCacheCenter.m
3 | // BLNetworking
4 | //
5 | // Created by casa on 2016/11/21.
6 | // Copyright © 2016年 casa. All rights reserved.
7 | //
8 |
9 | #import "CTCacheCenter.h"
10 | #import "CTMemoryCacheDataCenter.h"
11 | #import "CTMemoryCachedRecord.h"
12 | #import "CTLogger.h"
13 | #import "CTServiceFactory.h"
14 | #import "NSDictionary+AXNetworkingMethods.h"
15 | #import "CTDiskCacheCenter.h"
16 | #import "CTMemoryCacheDataCenter.h"
17 |
18 | @interface CTCacheCenter ()
19 |
20 | @property (nonatomic, strong) CTMemoryCacheDataCenter *memoryCacheCenter;
21 | @property (nonatomic, strong) CTDiskCacheCenter *diskCacheCenter;
22 |
23 | @end
24 |
25 | @implementation CTCacheCenter
26 |
27 | + (instancetype)sharedInstance
28 | {
29 | static CTCacheCenter *cacheCenter;
30 | static dispatch_once_t onceToken;
31 | dispatch_once(&onceToken, ^{
32 | cacheCenter = [[CTCacheCenter alloc] init];
33 | });
34 | return cacheCenter;
35 | }
36 |
37 | - (CTURLResponse *)fetchDiskCacheWithServiceIdentifier:(NSString *)serviceIdentifier methodName:(NSString *)methodName params:(NSDictionary *)params
38 | {
39 | CTURLResponse *response = [self.diskCacheCenter fetchCachedRecordWithKey:[self keyWithServiceIdentifier:serviceIdentifier methodName:methodName requestParams:params]];
40 | if (response) {
41 | response.logString = [CTLogger logDebugInfoWithCachedResponse:response methodName:methodName service:[[CTServiceFactory sharedInstance] serviceWithIdentifier:serviceIdentifier] params:params];
42 | }
43 | return response;
44 | }
45 |
46 | - (CTURLResponse *)fetchMemoryCacheWithServiceIdentifier:(NSString *)serviceIdentifier methodName:(NSString *)methodName params:(NSDictionary *)params
47 | {
48 | CTURLResponse *response = [self.memoryCacheCenter fetchCachedRecordWithKey:[self keyWithServiceIdentifier:serviceIdentifier methodName:methodName requestParams:params]];
49 | if (response) {
50 | response.logString = [CTLogger logDebugInfoWithCachedResponse:response methodName:methodName service:[[CTServiceFactory sharedInstance] serviceWithIdentifier:serviceIdentifier] params:params];
51 | }
52 | return response;
53 | }
54 |
55 | - (void)saveDiskCacheWithResponse:(CTURLResponse *)response serviceIdentifier:(NSString *)serviceIdentifier methodName:(NSString *)methodName cacheTime:(NSTimeInterval)cacheTime
56 | {
57 | if (response.originRequestParams && response.content && serviceIdentifier && methodName) {
58 | [self.diskCacheCenter saveCacheWithResponse:response key:[self keyWithServiceIdentifier:serviceIdentifier methodName:methodName requestParams:response.originRequestParams] cacheTime:cacheTime];
59 | }
60 | }
61 |
62 | - (void)saveMemoryCacheWithResponse:(CTURLResponse *)response serviceIdentifier:(NSString *)serviceIdentifier methodName:(NSString *)methodName cacheTime:(NSTimeInterval)cacheTime
63 | {
64 | if (response.originRequestParams && response.content && serviceIdentifier && methodName) {
65 | [self.memoryCacheCenter saveCacheWithResponse:response key:[self keyWithServiceIdentifier:serviceIdentifier methodName:methodName requestParams:response.originRequestParams] cacheTime:cacheTime];
66 | }
67 | }
68 |
69 | - (void)cleanAllDiskCache
70 | {
71 | [self.diskCacheCenter cleanAll];
72 | }
73 |
74 | - (void)cleanAllMemoryCache
75 | {
76 | [self.memoryCacheCenter cleanAll];
77 | }
78 |
79 | #pragma mark - private methods
80 | - (NSString *)keyWithServiceIdentifier:(NSString *)serviceIdentifier
81 | methodName:(NSString *)methodName
82 | requestParams:(NSDictionary *)requestParams
83 | {
84 | NSString *key = [NSString stringWithFormat:@"%@%@%@", serviceIdentifier, methodName, [requestParams CT_transformToUrlParamString]];
85 | return key;
86 | }
87 |
88 | #pragma mark - getters and setters
89 | - (CTDiskCacheCenter *)diskCacheCenter
90 | {
91 | if (_diskCacheCenter == nil) {
92 | _diskCacheCenter = [[CTDiskCacheCenter alloc] init];
93 | }
94 | return _diskCacheCenter;
95 | }
96 |
97 | - (CTMemoryCacheDataCenter *)memoryCacheCenter
98 | {
99 | if (_memoryCacheCenter == nil) {
100 | _memoryCacheCenter = [[CTMemoryCacheDataCenter alloc] init];
101 | }
102 | return _memoryCacheCenter;
103 | }
104 |
105 |
106 | @end
107 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Categories/String/NSString+AXNetworkingMethods.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSString+AXNetworkingMethods.m
3 | // RTNetworking
4 | //
5 | // Created by casa on 14-5-6.
6 | // Copyright (c) 2014年 casatwy. All rights reserved.
7 | //
8 |
9 | #import "NSString+AXNetworkingMethods.h"
10 | #include
11 | #import
12 | #import "NSObject+AXNetworkingMethods.h"
13 |
14 | static char base64EncodingTable[64] = {
15 | 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
16 | 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
17 | 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
18 | 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'
19 | };
20 |
21 | @implementation NSString (AXNetworkingMethods)
22 |
23 | - (NSString *)CT_MD5
24 | {
25 | NSData* inputData = [self dataUsingEncoding:NSUTF8StringEncoding];
26 | unsigned char outputData[CC_MD5_DIGEST_LENGTH];
27 | CC_MD5([inputData bytes], (unsigned int)[inputData length], outputData);
28 |
29 | NSMutableString* hashStr = [NSMutableString string];
30 | int i = 0;
31 | for (i = 0; i < CC_MD5_DIGEST_LENGTH; ++i)
32 | [hashStr appendFormat:@"%02x", outputData[i]];
33 |
34 | return hashStr;
35 | }
36 |
37 | - (NSString *)CT_SHA1
38 | {
39 | const char *cstr = [self cStringUsingEncoding:NSUTF8StringEncoding];
40 |
41 | NSData *data = [NSData dataWithBytes:cstr length:self.length];
42 | //使用对应的CC_SHA1,CC_SHA256,CC_SHA384,CC_SHA512的长度分别是20,32,48,64
43 | uint8_t digest[CC_SHA1_DIGEST_LENGTH];
44 | //使用对应的CC_SHA256,CC_SHA384,CC_SHA512
45 | CC_SHA1(data.bytes, (unsigned int)data.length, digest);
46 |
47 | NSMutableString* output = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH * 2];
48 |
49 | for(int i = 0; i < CC_SHA1_DIGEST_LENGTH; i++)
50 | [output appendFormat:@"%02x", digest[i]];
51 |
52 | return output;
53 | }
54 |
55 | - (NSString *)CT_Base64Encode
56 | {
57 | NSData *rawData = [self dataUsingEncoding:NSUTF8StringEncoding];
58 | unsigned long ixtext, lentext;
59 | long ctremaining;
60 | unsigned char input[3], output[4];
61 | short i, charsonline = 0, ctcopy;
62 | const unsigned char *raw;
63 | NSMutableString *result;
64 |
65 | lentext = [self length];
66 | if (lentext < 1)
67 | return @"";
68 | result = [NSMutableString stringWithCapacity:lentext];
69 | raw = [rawData bytes];
70 | ixtext = 0;
71 |
72 | while (true) {
73 | ctremaining = lentext - ixtext;
74 | if (ctremaining <= 0)
75 | break;
76 | for (i = 0; i < 3; i++) {
77 | unsigned long ix = ixtext + i;
78 | if (ix < lentext)
79 | input[i] = raw[ix];
80 | else
81 | input[i] = 0;
82 | }
83 | output[0] = (input[0] & 0xFC) >> 2;
84 | output[1] = ((input[0] & 0x03) << 4) | ((input[1] & 0xF0) >> 4);
85 | output[2] = ((input[1] & 0x0F) << 2) | ((input[2] & 0xC0) >> 6);
86 | output[3] = input[2] & 0x3F;
87 | ctcopy = 4;
88 | switch (ctremaining) {
89 | case 1:
90 | ctcopy = 2;
91 | break;
92 | case 2:
93 | ctcopy = 3;
94 | break;
95 | }
96 |
97 | for (i = 0; i < ctcopy; i++)
98 | [result appendString: [NSString stringWithFormat:@"%c", base64EncodingTable[output[i]]]];
99 |
100 | for (i = ctcopy; i < 4; i++)
101 | [result appendString:@"="];
102 |
103 | ixtext += 3;
104 | charsonline += 4;
105 |
106 | if ((lentext > 0) && (charsonline >= lentext))
107 | charsonline = 0;
108 | }
109 | return result;
110 | }
111 |
112 | #pragma mark - private methods
113 | - (int)char2Int:(char)c
114 | {
115 | if (c >= 'A' && c <= 'Z') {
116 | return c - 65;
117 | } else if (c >= 'a' && c <= 'z') {
118 | return c - 97 + 26;
119 | } else if (c >= '0' && c <= '9') {
120 | return c - 48 + 26 + 26;
121 | } else {
122 | switch(c) {
123 | case '+':
124 | return 62;
125 | case '/':
126 | return 63;
127 | case '=':
128 | return 0;
129 | default:
130 | return -1;
131 | }
132 | }
133 | }
134 |
135 | @end
136 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Components/APIProxy/CTApiProxy.m:
--------------------------------------------------------------------------------
1 | //
2 | // AXApiProxy.m
3 | // RTNetworking
4 | //
5 | // Created by casa on 14-5-12.
6 | // Copyright (c) 2014年 casatwy. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "CTApiProxy.h"
11 | #import "CTServiceFactory.h"
12 | #import "CTLogger.h"
13 | #import "NSURLRequest+CTNetworkingMethods.h"
14 | #import "NSString+AXNetworkingMethods.h"
15 | #import "NSObject+AXNetworkingMethods.h"
16 | #import "CTMediator+CTAppContext.h"
17 |
18 | static NSString * const kAXApiProxyDispatchItemKeyCallbackSuccess = @"kAXApiProxyDispatchItemCallbackSuccess";
19 | static NSString * const kAXApiProxyDispatchItemKeyCallbackFail = @"kAXApiProxyDispatchItemCallbackFail";
20 |
21 | NSString * const kCTApiProxyValidateResultKeyResponseObject = @"kCTApiProxyValidateResultKeyResponseObject";
22 | NSString * const kCTApiProxyValidateResultKeyResponseString = @"kCTApiProxyValidateResultKeyResponseString";
23 | //NSString * const kCTApiProxyValidateResultKeyResponseData = @"kCTApiProxyValidateResultKeyResponseData";
24 |
25 | @interface CTApiProxy ()
26 |
27 | @property (nonatomic, strong) NSMutableDictionary *dispatchTable;
28 | @property (nonatomic, strong) NSNumber *recordedRequestId;
29 |
30 | @end
31 |
32 | @implementation CTApiProxy
33 | #pragma mark - getters and setters
34 | - (NSMutableDictionary *)dispatchTable
35 | {
36 | if (_dispatchTable == nil) {
37 | _dispatchTable = [[NSMutableDictionary alloc] init];
38 | }
39 | return _dispatchTable;
40 | }
41 |
42 | - (AFHTTPSessionManager *)sessionManagerWithService:(id)service
43 | {
44 | AFHTTPSessionManager *sessionManager = nil;
45 | if ([service respondsToSelector:@selector(sessionManager)]) {
46 | sessionManager = service.sessionManager;
47 | }
48 | if (sessionManager == nil) {
49 | sessionManager = [AFHTTPSessionManager manager];
50 | }
51 | return sessionManager;
52 | }
53 |
54 | #pragma mark - life cycle
55 | + (instancetype)sharedInstance
56 | {
57 | static dispatch_once_t onceToken;
58 | static CTApiProxy *sharedInstance = nil;
59 | dispatch_once(&onceToken, ^{
60 | sharedInstance = [[CTApiProxy alloc] init];
61 | });
62 | return sharedInstance;
63 | }
64 |
65 | #pragma mark - public methods
66 | - (void)cancelRequestWithRequestID:(NSNumber *)requestID
67 | {
68 | NSURLSessionDataTask *requestOperation = self.dispatchTable[requestID];
69 | [requestOperation cancel];
70 | [self.dispatchTable removeObjectForKey:requestID];
71 | }
72 |
73 | - (void)cancelRequestWithRequestIDList:(NSArray *)requestIDList
74 | {
75 | for (NSNumber *requestId in requestIDList) {
76 | [self cancelRequestWithRequestID:requestId];
77 | }
78 | }
79 |
80 | /** 这个函数存在的意义在于,如果将来要把AFNetworking换掉,只要修改这个函数的实现即可。 */
81 | - (NSNumber *)callApiWithRequest:(NSURLRequest *)request success:(CTCallback)success fail:(CTCallback)fail
82 | {
83 | // 跑到这里的block的时候,就已经是主线程了。
84 | __block NSURLSessionDataTask *dataTask = nil;
85 | dataTask = [[self sessionManagerWithService:request.service] dataTaskWithRequest:request
86 | uploadProgress:nil
87 | downloadProgress:nil
88 | completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) {
89 | NSNumber *requestID = @([dataTask taskIdentifier]);
90 | [self.dispatchTable removeObjectForKey:requestID];
91 |
92 | NSDictionary *result = [request.service resultWithResponseObject:responseObject response:response request:request error:&error];
93 | // 输出返回数据
94 | CTURLResponse *CTResponse = [[CTURLResponse alloc] initWithResponseString:result[kCTApiProxyValidateResultKeyResponseString]
95 | requestId:requestID
96 | request:request
97 | responseObject:result[kCTApiProxyValidateResultKeyResponseObject]
98 | error:error];
99 |
100 | CTResponse.logString = [CTLogger logDebugInfoWithResponse:(NSHTTPURLResponse *)response
101 | responseObject:responseObject
102 | responseString:result[kCTApiProxyValidateResultKeyResponseString]
103 | request:request
104 | error:error];
105 |
106 | if (error) {
107 | fail?fail(CTResponse):nil;
108 | } else {
109 | success?success(CTResponse):nil;
110 | }
111 | }];
112 |
113 | NSNumber *requestId = @([dataTask taskIdentifier]);
114 |
115 | self.dispatchTable[requestId] = dataTask;
116 | [dataTask resume];
117 |
118 | return requestId;
119 | }
120 |
121 | @end
122 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Components/BaseAPITarget/H5API/Target_H5API.m:
--------------------------------------------------------------------------------
1 | //
2 | // BLBaseAPITarget.m
3 | // BLNetworking
4 | //
5 | // Created by casa on 2017/1/18.
6 | // Copyright © 2017年 casa. All rights reserved.
7 | //
8 |
9 | #import "Target_H5API.h"
10 | #import "CTApiProxy.h"
11 |
12 | typedef void (^CTH5APICallback)(NSDictionary *result);
13 |
14 | NSString * const kCTBaseAPITargetAPIContextDataKeyParamsForAPI = @"kCTBaseAPITargetAPIContextDataKeyParamsForAPI";
15 | NSString * const kCTBaseAPITargetAPIContextDataKeyParamsAPIManager = @"kCTBaseAPITargetAPIContextDataKeyParamsAPIManager";
16 | NSString * const kCTBaseAPITargetAPIContextDataKeyOriginActionParams = @"kCTBaseAPITargetAPIContextDataKeyOriginActionParams";
17 |
18 | NSString * const kCTOriginActionCallbackKeySuccess = @"success";
19 | NSString * const kCTOriginActionCallbackKeyFail = @"fail";
20 | NSString * const kCTOriginActionCallbackKeyProgress = @"progress";
21 |
22 | @interface Target_H5API ()
23 |
24 | @property (nonatomic, strong, readwrite) NSMutableDictionary *APIContextDictionary;
25 |
26 | @end
27 |
28 | @implementation Target_H5API
29 |
30 | - (id)Action_loadAPI:(NSDictionary *)params
31 | {
32 | NSDictionary *paramsForAPI = params[@"data"];
33 |
34 | if (paramsForAPI == nil) {
35 | paramsForAPI = @{};
36 | }
37 |
38 | if ([paramsForAPI isKindOfClass:[NSDictionary class]] == NO) {
39 | return nil;
40 | }
41 |
42 | Class APIManagerClass = NSClassFromString(params[@"apiName"]);
43 | CTAPIBaseManager *apiManager = [[APIManagerClass alloc] init];
44 | if ([apiManager isKindOfClass:[CTAPIBaseManager class]]) {
45 | self.APIContextDictionary[apiManager] = @{
46 | kCTBaseAPITargetAPIContextDataKeyParamsForAPI:paramsForAPI,
47 | kCTBaseAPITargetAPIContextDataKeyOriginActionParams:params,
48 | kCTBaseAPITargetAPIContextDataKeyParamsAPIManager:apiManager
49 | };
50 |
51 | apiManager.delegate = self;
52 | apiManager.paramSource = self;
53 | apiManager.interceptor = self;
54 | [apiManager loadData];
55 | }
56 | return nil;
57 | }
58 |
59 | #pragma mark - CTAPIManagerCallBackDelegate
60 | - (void)managerCallAPIDidSuccess:(CTAPIBaseManager *)manager
61 | {
62 | CTH5APICallback successCallback = self.APIContextDictionary[manager][kCTBaseAPITargetAPIContextDataKeyOriginActionParams][kCTOriginActionCallbackKeySuccess];
63 | if (successCallback) {
64 | NSMutableDictionary *fetchedData = [manager fetchDataWithReformer:nil];
65 | if ([fetchedData isKindOfClass:[NSMutableDictionary class]]) {
66 | [fetchedData removeObjectForKey:kCTApiProxyValidateResultKeyResponseString];
67 | // [fetchedData removeObjectForKey:kCTApiProxyValidateResultKeyResponseData];
68 | }
69 | successCallback(fetchedData);
70 | }
71 | [self.APIContextDictionary removeObjectForKey:manager];
72 | }
73 |
74 | - (void)managerCallAPIDidFailed:(CTAPIBaseManager *)manager
75 | {
76 | CTH5APICallback failCallback = self.APIContextDictionary[manager][kCTBaseAPITargetAPIContextDataKeyOriginActionParams][kCTOriginActionCallbackKeyFail];
77 | if (failCallback) {
78 | failCallback([manager fetchDataWithReformer:nil]);
79 | }
80 | [self.APIContextDictionary removeObjectForKey:manager];
81 | }
82 |
83 | #pragma mark - CTAPIManagerInterceptor
84 | - (void)manager:(CTAPIBaseManager *)manager didReceiveResponse:(CTURLResponse *)response
85 | {
86 | CTH5APICallback progressCallback = self.APIContextDictionary[manager][kCTBaseAPITargetAPIContextDataKeyOriginActionParams][kCTOriginActionCallbackKeyProgress];
87 | if (progressCallback) {
88 | progressCallback(@{
89 | @"result":@"progress",
90 | @"status":@"request finished"
91 | });
92 | }
93 | }
94 |
95 | - (BOOL)manager:(CTAPIBaseManager *)manager shouldCallAPIWithParams:(NSDictionary *)params
96 | {
97 | CTH5APICallback progressCallback = self.APIContextDictionary[manager][kCTBaseAPITargetAPIContextDataKeyOriginActionParams][kCTOriginActionCallbackKeyProgress];
98 | if (progressCallback) {
99 | progressCallback(@{
100 | @"result":@"progress",
101 | @"status":@"request started"
102 | });
103 | }
104 | return YES;
105 | }
106 |
107 | #pragma mark - CTAPIManagerParamSource
108 | - (NSDictionary *)paramsForApi:(CTAPIBaseManager *)manager
109 | {
110 | NSDictionary *result = self.APIContextDictionary[manager][kCTBaseAPITargetAPIContextDataKeyParamsForAPI];
111 | return result;
112 | }
113 |
114 | #pragma mark - getters and setters
115 | - (NSMutableDictionary *)APIContextDictionary
116 | {
117 | if (_APIContextDictionary == nil) {
118 | _APIContextDictionary = [[NSMutableDictionary alloc] init];
119 | }
120 | return _APIContextDictionary;
121 | }
122 |
123 | @end
124 |
--------------------------------------------------------------------------------
/CTNetworking.podspec:
--------------------------------------------------------------------------------
1 | #
2 | # Be sure to run `pod spec lint BLAPIManagers.podspec' to ensure this is a
3 | # valid spec and to remove all comments including this before submitting the spec.
4 | #
5 | # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
6 | # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
7 | #
8 |
9 | Pod::Spec.new do |s|
10 |
11 | # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
12 | #
13 | # These will help people to find your library, and whilst it
14 | # can feel like a chore to fill in it's definitely to your advantage. The
15 | # summary should be tweet-length, and the description more in depth.
16 | #
17 |
18 | s.name = "CTNetworking"
19 | s.version = "15"
20 | s.summary = "CTNetworking."
21 |
22 | # This description is used to generate tags and improve search results.
23 | # * Think: What does it do? Why did you write it? What is the focus?
24 | # * Try to keep it short, snappy and to the point.
25 | # * Write the description between the DESC delimiters below.
26 | # * Finally, don't worry about the indent, CocoaPods strips it!
27 | s.description = <<-DESC
28 | this is CTNetworking
29 | DESC
30 |
31 | s.homepage = "https://github.com/casatwy/CTNetworking"
32 | # s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"
33 |
34 |
35 | # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
36 | #
37 | # Licensing your code is important. See http://choosealicense.com for more info.
38 | # CocoaPods will detect a license file if there is a named LICENSE*
39 | # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
40 | #
41 |
42 | # s.license = "MIT (example)"
43 | s.license = { :type => "MIT", :file => "FILE_LICENSE" }
44 |
45 |
46 | # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
47 | #
48 | # Specify the authors of the library, with email addresses. Email addresses
49 | # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also
50 | # accepts just a name if you'd rather not provide an email address.
51 | #
52 | # Specify a social_media_url where others can refer to, for example a twitter
53 | # profile URL.
54 | #
55 |
56 | s.author = { "CasaTaloyum" => "casatwy@msn.com" }
57 | # Or just: s.author = "CasaTaloyum"
58 | # s.authors = { "CasaTaloyum" => "casatwy@msn.com" }
59 | # s.social_media_url = "http://twitter.com/CasaTaloyum"
60 |
61 | # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
62 | #
63 | # If this Pod runs only on iOS or OS X, then specify the platform and
64 | # the deployment target. You can optionally include the target after the platform.
65 | #
66 |
67 | # s.platform = :ios
68 | s.platform = :ios, "8.0"
69 |
70 | # When using multiple platforms
71 | # s.ios.deployment_target = "5.0"
72 | # s.osx.deployment_target = "10.7"
73 | # s.watchos.deployment_target = "2.0"
74 | # s.tvos.deployment_target = "9.0"
75 |
76 |
77 | # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
78 | #
79 | # Specify the location from where the source should be retrieved.
80 | # Supports git, hg, bzr, svn and HTTP.
81 | #
82 |
83 | s.source = { :git => "https://github.com/casatwy/CTNetworking.git", :tag => s.version.to_s }
84 |
85 |
86 | # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
87 | #
88 | # CocoaPods is smart about how it includes source code. For source files
89 | # giving a folder will include any swift, h, m, mm, c & cpp files.
90 | # For header files it will include any header in the folder.
91 | # Not including the public_header_files will make all headers public.
92 | #
93 |
94 | s.source_files = "CTNetworking/CTNetworking/**/*.{h,m}"
95 | # s.exclude_files = "Classes/Exclude"
96 |
97 | # s.public_header_files = "Classes/**/*.h"
98 |
99 |
100 | # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
101 | #
102 | # A list of resources included with the Pod. These are copied into the
103 | # target bundle with a build phase script. Anything else will be cleaned.
104 | # You can preserve files from being cleaned, please don't preserve
105 | # non-essential files like tests, examples and documentation.
106 | #
107 |
108 | # s.ios.resource = "icon.png"
109 | # s.ios.resources = "Resources/*.png"
110 |
111 | # s.ios.preserve_paths = "FilesToSave", "MoreFilesToSave"
112 |
113 |
114 | # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
115 | #
116 | # Link your library with frameworks, or libraries. Libraries do not include
117 | # the lib prefix of their name.
118 | #
119 |
120 | # s.framework = "SomeFramework"
121 | # s.frameworks = "SomeFramework", "AnotherFramework"
122 |
123 | # s.library = "iconv"
124 | # s.libraries = "iconv", "xml2"
125 |
126 |
127 | # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
128 | #
129 | # If your library depends on compiler flags you can set them in the xcconfig hash
130 | # where they will only apply to your library. If you depend on other Podspecs
131 | # you can include multiple dependencies to ensure it works.
132 |
133 | s.requires_arc = true
134 |
135 | # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
136 | s.dependency "AFNetworking"
137 | s.dependency "CTMediator"
138 |
139 | end
140 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/CTNetworkingDefines.h:
--------------------------------------------------------------------------------
1 | //
2 | // CTNetworkingDefines.h
3 | // CTNetworking
4 | //
5 | // Created by casa on 2018/2/27.
6 | // Copyright © 2018年 casa. All rights reserved.
7 | //
8 |
9 | #ifndef CTNetworkingDefines_h
10 | #define CTNetworkingDefines_h
11 |
12 | #import
13 |
14 | @class CTAPIBaseManager;
15 | @class CTURLResponse;
16 |
17 | typedef NS_ENUM (NSUInteger, CTServiceAPIEnvironment){
18 | CTServiceAPIEnvironmentDevelop,
19 | CTServiceAPIEnvironmentReleaseCandidate,
20 | CTServiceAPIEnvironmentRelease
21 | };
22 |
23 | typedef NS_ENUM (NSUInteger, CTAPIManagerRequestType){
24 | CTAPIManagerRequestTypePost,
25 | CTAPIManagerRequestTypeGet,
26 | CTAPIManagerRequestTypePut,
27 | CTAPIManagerRequestTypeDelete,
28 | };
29 |
30 | typedef NS_ENUM (NSUInteger, CTAPIManagerErrorType){
31 | CTAPIManagerErrorTypeNeedAccessToken, // 需要重新刷新accessToken
32 | CTAPIManagerErrorTypeNeedLogin, // 需要登陆
33 | CTAPIManagerErrorTypeDefault, // 没有产生过API请求,这个是manager的默认状态。
34 | CTAPIManagerErrorTypeLoginCanceled, // 调用API需要登陆态,弹出登陆页面之后用户取消登陆了
35 | CTAPIManagerErrorTypeSuccess, // API请求成功且返回数据正确,此时manager的数据是可以直接拿来使用的。
36 | CTAPIManagerErrorTypeNoContent, // API请求成功但返回数据不正确。如果回调数据验证函数返回值为NO,manager的状态就会是这个。
37 | CTAPIManagerErrorTypeParamsError, // 参数错误,此时manager不会调用API,因为参数验证是在调用API之前做的。
38 | CTAPIManagerErrorTypeTimeout, // 请求超时。CTAPIProxy设置的是20秒超时,具体超时时间的设置请自己去看CTAPIProxy的相关代码。
39 | CTAPIManagerErrorTypeNoNetWork, // 网络不通。在调用API之前会判断一下当前网络是否通畅,这个也是在调用API之前验证的,和上面超时的状态是有区别的。
40 | CTAPIManagerErrorTypeCanceled, // 取消请求
41 | CTAPIManagerErrorTypeNoError, // 无错误
42 | CTAPIManagerErrorTypeDownGrade, // APIManager被降级了
43 | };
44 |
45 | typedef NS_OPTIONS(NSUInteger, CTAPIManagerCachePolicy) {
46 | CTAPIManagerCachePolicyNoCache = 0,
47 | CTAPIManagerCachePolicyMemory = 1 << 0,
48 | CTAPIManagerCachePolicyDisk = 1 << 1,
49 | };
50 |
51 | extern NSString * _Nonnull const kCTAPIBaseManagerRequestID;
52 |
53 | // notification name
54 | extern NSString * _Nonnull const kCTUserTokenInvalidNotification;
55 | extern NSString * _Nonnull const kCTUserTokenIllegalNotification;
56 | extern NSString * _Nonnull const kCTUserTokenNotificationUserInfoKeyManagerToContinue;
57 |
58 | // result
59 | extern NSString * _Nonnull const kCTApiProxyValidateResultKeyResponseObject;
60 | extern NSString * _Nonnull const kCTApiProxyValidateResultKeyResponseString;
61 | //extern NSString * _Nonnull const kCTApiProxyValidateResultKeyResponseData;
62 |
63 | /*************************************************************************************/
64 | @protocol CTAPIManager
65 |
66 | @required
67 | - (NSString *_Nonnull)methodName;
68 | - (NSString *_Nonnull)serviceIdentifier;
69 | - (CTAPIManagerRequestType)requestType;
70 |
71 | @optional
72 | - (void)cleanData;
73 | - (NSDictionary *_Nullable)reformParams:(NSDictionary *_Nullable)params;
74 | - (NSInteger)loadDataWithParams:(NSDictionary *_Nullable)params;
75 |
76 | @end
77 |
78 | /*************************************************************************************/
79 | @protocol CTAPIManagerInterceptor
80 |
81 | @optional
82 | - (BOOL)manager:(CTAPIBaseManager *_Nonnull)manager beforePerformSuccessWithResponse:(CTURLResponse *_Nonnull)response;
83 | - (void)manager:(CTAPIBaseManager *_Nonnull)manager afterPerformSuccessWithResponse:(CTURLResponse *_Nonnull)response;
84 |
85 | - (BOOL)manager:(CTAPIBaseManager *_Nonnull)manager beforePerformFailWithResponse:(CTURLResponse *_Nonnull)response;
86 | - (void)manager:(CTAPIBaseManager *_Nonnull)manager afterPerformFailWithResponse:(CTURLResponse *_Nonnull)response;
87 |
88 | - (BOOL)manager:(CTAPIBaseManager *_Nonnull)manager shouldCallAPIWithParams:(NSDictionary *_Nullable)params;
89 | - (void)manager:(CTAPIBaseManager *_Nonnull)manager afterCallingAPIWithParams:(NSDictionary *_Nullable)params;
90 | - (void)manager:(CTAPIBaseManager *_Nonnull)manager didReceiveResponse:(CTURLResponse *_Nullable)response;
91 |
92 | @end
93 |
94 | /*************************************************************************************/
95 |
96 | @protocol CTAPIManagerCallBackDelegate
97 | @required
98 | - (void)managerCallAPIDidSuccess:(CTAPIBaseManager * _Nonnull)manager;
99 | - (void)managerCallAPIDidFailed:(CTAPIBaseManager * _Nonnull)manager;
100 | @end
101 |
102 | @protocol CTPagableAPIManager
103 |
104 | @property (nonatomic, assign) NSInteger pageSize;
105 | @property (nonatomic, assign, readonly) NSUInteger currentPageNumber;
106 | @property (nonatomic, assign, readonly) BOOL isFirstPage;
107 | @property (nonatomic, assign, readonly) BOOL isLastPage;
108 |
109 | - (void)loadNextPage;
110 |
111 | @end
112 |
113 | /*************************************************************************************/
114 |
115 | @protocol CTAPIManagerDataReformer
116 | @required
117 | - (id _Nullable)manager:(CTAPIBaseManager * _Nonnull)manager reformData:(NSDictionary * _Nullable)data;
118 | @end
119 |
120 | /*************************************************************************************/
121 |
122 | @protocol CTAPIManagerValidator
123 | @required
124 | - (CTAPIManagerErrorType)manager:(CTAPIBaseManager *_Nonnull)manager isCorrectWithCallBackData:(NSDictionary *_Nullable)data;
125 | - (CTAPIManagerErrorType)manager:(CTAPIBaseManager *_Nonnull)manager isCorrectWithParamsData:(NSDictionary *_Nullable)data;
126 | @end
127 |
128 | /*************************************************************************************/
129 |
130 | @protocol CTAPIManagerParamSource
131 | @required
132 | - (NSDictionary *_Nullable)paramsForApi:(CTAPIBaseManager *_Nonnull)manager;
133 | @end
134 |
135 | #endif /* CTNetworkingDefines_h */
136 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Components/LogComponents/CTLogger.m:
--------------------------------------------------------------------------------
1 | //
2 | // AXLogger.m
3 | // RTNetworking
4 | //
5 | // Created by casa on 14-5-6.
6 | // Copyright (c) 2014年 casatwy. All rights reserved.
7 | //
8 |
9 | #import "CTLogger.h"
10 |
11 | #import "NSObject+AXNetworkingMethods.h"
12 | #import "NSMutableString+AXNetworkingMethods.h"
13 | #import "NSArray+AXNetworkingMethods.h"
14 | #import "NSURLRequest+CTNetworkingMethods.h"
15 | #import "NSDictionary+AXNetworkingMethods.h"
16 | #import "CTMediator+CTAppContext.h"
17 |
18 | #import "CTApiProxy.h"
19 | #import "CTServiceFactory.h"
20 | #import "CTNetworkingDefines.h"
21 |
22 | @interface CTLogger ()
23 |
24 | @end
25 |
26 | @implementation CTLogger
27 |
28 | + (NSString *)logDebugInfoWithRequest:(NSURLRequest *)request apiName:(NSString *)apiName service:(id )service
29 | {
30 | NSMutableString *logString = nil;
31 | #ifdef DEBUG
32 | if ([CTMediator sharedInstance].CTNetworking_shouldPrintNetworkingLog == NO) {
33 | return @"";
34 | }
35 |
36 | CTServiceAPIEnvironment enviroment = request.service.apiEnvironment;
37 | NSString *enviromentString = nil;
38 | if (enviroment == CTServiceAPIEnvironmentDevelop) {
39 | enviromentString = @"Develop";
40 | }
41 | if (enviroment == CTServiceAPIEnvironmentReleaseCandidate) {
42 | enviromentString = @"Pre Release";
43 | }
44 | if (enviroment == CTServiceAPIEnvironmentRelease) {
45 | enviromentString = @"Release";
46 | }
47 |
48 | logString = [NSMutableString stringWithString:@"\n\n********************************************************\nRequest Start\n********************************************************\n\n"];
49 |
50 | [logString appendFormat:@"API Name:\t\t%@\n", [apiName CT_defaultValue:@"N/A"]];
51 | [logString appendFormat:@"Method:\t\t\t%@\n", request.HTTPMethod];
52 | [logString appendFormat:@"Service:\t\t%@\n", [service class]];
53 | [logString appendFormat:@"Status:\t\t\t%@\n", enviromentString];
54 | [logString appendURLRequest:request];
55 |
56 | [logString appendFormat:@"\n\n********************************************************\nRequest End\n********************************************************\n\n\n\n"];
57 | NSLog(@"%@", logString);
58 | #endif
59 | return logString;
60 | }
61 |
62 | + (NSString *)logDebugInfoWithResponse:(NSHTTPURLResponse *)response responseObject:(id)responseObject responseString:(NSString *)responseString request:(NSURLRequest *)request error:(NSError *)error
63 | {
64 | NSMutableString *logString = nil;
65 | #ifdef DEBUG
66 | if ([CTMediator sharedInstance].CTNetworking_shouldPrintNetworkingLog == NO) {
67 | return @"";
68 | }
69 |
70 | BOOL isSuccess = error ? NO : YES;
71 |
72 | logString = [NSMutableString stringWithString:@"\n\n=========================================\nAPI Response\n=========================================\n\n"];
73 |
74 | [logString appendFormat:@"Status:\t%ld\t(%@)\n\n", (long)response.statusCode, [NSHTTPURLResponse localizedStringForStatusCode:response.statusCode]];
75 | [logString appendFormat:@"Content:\n\t%@\n\n", responseString];
76 | [logString appendFormat:@"Request URL:\n\t%@\n\n", request.URL];
77 | [logString appendFormat:@"Request Data:\n\t%@\n\n",request.originRequestParams.CT_jsonString];
78 | if ([responseObject isKindOfClass:[NSData class]]) {
79 | [logString appendFormat:@"Raw Response String:\n\t%@\n\n", [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]];
80 | } else {
81 | [logString appendFormat:@"Raw Response String:\n\t%@\n\n", responseObject];
82 | }
83 | [logString appendFormat:@"Raw Response Header:\n\t%@\n\n", response.allHeaderFields];
84 | if (isSuccess == NO) {
85 | [logString appendFormat:@"Error Domain:\t\t\t\t\t\t\t%@\n", error.domain];
86 | [logString appendFormat:@"Error Domain Code:\t\t\t\t\t\t%ld\n", (long)error.code];
87 | [logString appendFormat:@"Error Localized Description:\t\t\t%@\n", error.localizedDescription];
88 | [logString appendFormat:@"Error Localized Failure Reason:\t\t\t%@\n", error.localizedFailureReason];
89 | [logString appendFormat:@"Error Localized Recovery Suggestion:\t%@\n\n", error.localizedRecoverySuggestion];
90 | }
91 |
92 | [logString appendString:@"\n--------------- Related Request Content --------------\n"];
93 |
94 | [logString appendURLRequest:request];
95 |
96 | [logString appendFormat:@"\n\n=========================================\nResponse End\n=========================================\n\n"];
97 |
98 | NSLog(@"%@", logString);
99 | #endif
100 |
101 | return logString;
102 | }
103 |
104 | +(NSString *)logDebugInfoWithCachedResponse:(CTURLResponse *)response methodName:(NSString *)methodName service:(id )service params:(NSDictionary *)params
105 | {
106 | NSMutableString *logString = nil;
107 | #ifdef DEBUG
108 | if ([CTMediator sharedInstance].CTNetworking_shouldPrintNetworkingLog == NO) {
109 | return @"";
110 | }
111 |
112 | logString = [NSMutableString stringWithString:@"\n\n=========================================\nCached Response \n=========================================\n\n"];
113 |
114 | [logString appendFormat:@"API Name:\t\t%@\n", [methodName CT_defaultValue:@"N/A"]];
115 | [logString appendFormat:@"Service:\t\t%@\n", [service class]];
116 | [logString appendFormat:@"Method Name:\t%@\n", methodName];
117 | [logString appendFormat:@"Params:\n%@\n\n", params];
118 | [logString appendFormat:@"Origin Params:\n%@\n\n", response.originRequestParams];
119 | [logString appendFormat:@"Actual Params:\n%@\n\n", response.acturlRequestParams];
120 | [logString appendFormat:@"Content:\n\t%@\n\n", response.contentString];
121 |
122 | [logString appendFormat:@"\n\n=========================================\nResponse End\n=========================================\n\n"];
123 | NSLog(@"%@", logString);
124 | #endif
125 |
126 | return logString;
127 | }
128 |
129 | @end
130 |
--------------------------------------------------------------------------------
/CTNetworking/Demo/DemoService/DemoService.m:
--------------------------------------------------------------------------------
1 | //
2 | // DemoService.m
3 | // CTNetworking
4 | //
5 | // Created by casa on 2018/2/27.
6 | // Copyright © 2018年 casa. All rights reserved.
7 | //
8 |
9 | #import "DemoService.h"
10 | #import
11 | #import "CTNetworking.h"
12 |
13 | @interface DemoService ()
14 |
15 | @property (nonatomic, strong) NSString *publicKey;
16 | @property (nonatomic, strong) NSString *privateKey;
17 | @property (nonatomic, strong) NSString *baseURL;
18 |
19 | @property (nonatomic, strong) AFHTTPRequestSerializer *httpRequestSerializer;
20 |
21 | @end
22 |
23 | @implementation DemoService
24 |
25 | #pragma mark - public methods
26 | - (NSURLRequest *)requestWithParams:(NSDictionary *)params methodName:(NSString *)methodName requestType:(CTAPIManagerRequestType)requestType
27 | {
28 | if (requestType == CTAPIManagerRequestTypeGet) {
29 | NSString *urlString = [NSString stringWithFormat:@"%@/%@", self.baseURL, methodName];
30 | NSString *tsString = [NSUUID UUID].UUIDString;
31 | NSString *md5Hash = [[NSString stringWithFormat:@"%@%@%@", tsString, self.privateKey, self.publicKey] CT_MD5];
32 | NSMutableURLRequest *request = [self.httpRequestSerializer requestWithMethod:@"GET"
33 | URLString:urlString
34 | parameters:@{
35 | @"apikey":self.publicKey,
36 | @"ts":tsString,
37 | @"hash":md5Hash
38 | }
39 | error:nil];
40 | return request;
41 | }
42 |
43 | return nil;
44 | }
45 |
46 | - (NSDictionary *)resultWithResponseObject:(id)responseObject response:(NSURLResponse *)response request:(NSURLRequest *)request error:(NSError **)error
47 | {
48 | NSMutableDictionary *result = [[NSMutableDictionary alloc] init];
49 | if (*error || !responseObject) {
50 | return result;
51 | }
52 |
53 | if ([responseObject isKindOfClass:[NSData class]]) {
54 | result[kCTApiProxyValidateResultKeyResponseString] = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
55 | result[kCTApiProxyValidateResultKeyResponseObject] = [NSJSONSerialization JSONObjectWithData:responseObject options:0 error:NULL];
56 | } else {
57 | //这里的kCTApiProxyValidateResultKeyResponseString是用作打印日志用的,实际使用时可以把实际类型的对象转换成string用于日志打印
58 | // result[kCTApiProxyValidateResultKeyResponseString] = responseObject;
59 | result[kCTApiProxyValidateResultKeyResponseObject] = responseObject;
60 | }
61 |
62 | return result;
63 | }
64 |
65 | - (BOOL)handleCommonErrorWithResponse:(CTURLResponse *)response manager:(CTAPIBaseManager *)manager errorType:(CTAPIManagerErrorType)errorType
66 | {
67 | // 业务上这些错误码表示需要重新登录
68 | NSString *resCode = [NSString stringWithFormat:@"%@", response.content[@"resCode"]];
69 | if ([resCode isEqualToString:@"00100009"]
70 | || [resCode isEqualToString:@"05111001"]
71 | || [resCode isEqualToString:@"05111002"]
72 | || [resCode isEqualToString:@"1080002"]
73 | ) {
74 | [[NSNotificationCenter defaultCenter] postNotificationName:kCTUserTokenIllegalNotification
75 | object:nil
76 | userInfo:@{
77 | kCTUserTokenNotificationUserInfoKeyManagerToContinue:self
78 | }];
79 | return NO;
80 | }
81 |
82 | // 业务上这些错误码表示需要刷新token
83 | NSString *errorCode = [NSString stringWithFormat:@"%@", response.content[@"errorCode"]];
84 | if ([response.content[@"errorMsg"] isEqualToString:@"invalid token"]
85 | || [response.content[@"errorMsg"] isEqualToString:@"access_token is required"]
86 | || [errorCode isEqualToString:@"BL10015"]
87 | ) {
88 | [[NSNotificationCenter defaultCenter] postNotificationName:kCTUserTokenInvalidNotification
89 | object:nil
90 | userInfo:@{
91 | kCTUserTokenNotificationUserInfoKeyManagerToContinue:self
92 | }];
93 | return NO;
94 | }
95 |
96 | return YES;
97 | }
98 |
99 | #pragma mark - getters and setters
100 | - (NSString *)publicKey
101 | {
102 | return @"d97bab99fa506c7cdf209261ffd06652";
103 | }
104 |
105 | - (NSString *)privateKey
106 | {
107 | return @"31bb736a11cbc10271517816540e626c4ff2279a";
108 | }
109 |
110 | - (NSString *)baseURL
111 | {
112 | if (self.apiEnvironment == CTServiceAPIEnvironmentRelease) {
113 | return @"https://gateway.marvel.com:443/v1";
114 | }
115 | if (self.apiEnvironment == CTServiceAPIEnvironmentDevelop) {
116 | return @"https://gateway.marvel.com:443/v1";
117 | }
118 | if (self.apiEnvironment == CTServiceAPIEnvironmentReleaseCandidate) {
119 | return @"https://gateway.marvel.com:443/v1";
120 | }
121 | return @"https://gateway.marvel.com:443/v1";
122 | }
123 |
124 | - (CTServiceAPIEnvironment)apiEnvironment
125 | {
126 | return CTServiceAPIEnvironmentRelease;
127 | }
128 |
129 | - (AFHTTPRequestSerializer *)httpRequestSerializer
130 | {
131 | if (_httpRequestSerializer == nil) {
132 | _httpRequestSerializer = [AFHTTPRequestSerializer serializer];
133 | [_httpRequestSerializer setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
134 | }
135 | return _httpRequestSerializer;
136 | }
137 |
138 | @end
139 |
--------------------------------------------------------------------------------
/CTNetworking/CTNetworking/Components/BaseAPIManager/CTAPIBaseManager.m:
--------------------------------------------------------------------------------
1 | //
2 | // AJKBaseManager.m
3 | // casatwy2
4 | //
5 | // Created by casa on 13-12-2.
6 | // Copyright (c) 2013年 casatwy inc. All rights reserved.
7 | //
8 |
9 | #import "CTAPIBaseManager.h"
10 | #import "CTNetworking.h"
11 | #import "CTCacheCenter.h"
12 | #import "CTLogger.h"
13 | #import "CTServiceFactory.h"
14 | #import "CTApiProxy.h"
15 | #import "CTMediator+CTAppContext.h"
16 | #import "CTServiceFactory.h"
17 |
18 | NSString * const kCTUserTokenInvalidNotification = @"kCTUserTokenInvalidNotification";
19 | NSString * const kCTUserTokenIllegalNotification = @"kCTUserTokenIllegalNotification";
20 |
21 | NSString * const kCTUserTokenNotificationUserInfoKeyManagerToContinue = @"kCTUserTokenNotificationUserInfoKeyManagerToContinue";
22 | NSString * const kCTAPIBaseManagerRequestID = @"kCTAPIBaseManagerRequestID";
23 |
24 |
25 | @interface CTAPIBaseManager ()
26 |
27 | @property (nonatomic, strong, readwrite) id fetchedRawData;
28 | @property (nonatomic, assign, readwrite) BOOL isLoading;
29 | @property (nonatomic, copy, readwrite) NSString *errorMessage;
30 |
31 | @property (nonatomic, readwrite) CTAPIManagerErrorType errorType;
32 | @property (nonatomic, strong) NSMutableArray *requestIdList;
33 |
34 | @property (nonatomic, strong, nullable) void (^successBlock)(CTAPIBaseManager *apimanager);
35 | @property (nonatomic, strong, nullable) void (^failBlock)(CTAPIBaseManager *apimanager);
36 |
37 | @end
38 |
39 | @implementation CTAPIBaseManager
40 |
41 | #pragma mark - life cycle
42 | - (instancetype)init
43 | {
44 | self = [super init];
45 | if (self) {
46 | _delegate = nil;
47 | _validator = nil;
48 | _paramSource = nil;
49 |
50 | _fetchedRawData = nil;
51 |
52 | _errorMessage = nil;
53 | _errorType = CTAPIManagerErrorTypeDefault;
54 |
55 | _memoryCacheSecond = 3 * 60;
56 | _diskCacheSecond = 3 * 60;
57 |
58 | if ([self conformsToProtocol:@protocol(CTAPIManager)]) {
59 | self.child = (id )self;
60 | } else {
61 | NSException *exception = [[NSException alloc] init];
62 | @throw exception;
63 | }
64 | }
65 | return self;
66 | }
67 |
68 | - (void)dealloc
69 | {
70 | [self cancelAllRequests];
71 | self.requestIdList = nil;
72 | }
73 |
74 | #pragma mark - NSCopying
75 | - (id)copyWithZone:(NSZone *)zone
76 | {
77 | return self;
78 | }
79 |
80 | #pragma mark - public methods
81 | - (void)cancelAllRequests
82 | {
83 | [[CTApiProxy sharedInstance] cancelRequestWithRequestIDList:self.requestIdList];
84 | [self.requestIdList removeAllObjects];
85 | }
86 |
87 | - (void)cancelRequestWithRequestId:(NSInteger)requestID
88 | {
89 | [self removeRequestIdWithRequestID:requestID];
90 | [[CTApiProxy sharedInstance] cancelRequestWithRequestID:@(requestID)];
91 | }
92 |
93 | - (id)fetchDataWithReformer:(id)reformer
94 | {
95 | id resultData = nil;
96 | if ([reformer respondsToSelector:@selector(manager:reformData:)]) {
97 | resultData = [reformer manager:self reformData:self.fetchedRawData];
98 | } else {
99 | resultData = [self.fetchedRawData mutableCopy];
100 | }
101 | return resultData;
102 | }
103 |
104 | #pragma mark - calling api
105 | - (NSInteger)loadData
106 | {
107 | NSDictionary *params = [self.paramSource paramsForApi:self];
108 | NSInteger requestId = [self loadDataWithParams:params];
109 | return requestId;
110 | }
111 |
112 | + (NSInteger)loadDataWithParams:(NSDictionary *)params success:(void (^)(CTAPIBaseManager *))successCallback fail:(void (^)(CTAPIBaseManager *))failCallback
113 | {
114 | return [[[self alloc] init] loadDataWithParams:params success:successCallback fail:failCallback];
115 | }
116 |
117 | - (NSInteger)loadDataWithParams:(NSDictionary *)params success:(void (^)(CTAPIBaseManager *))successCallback fail:(void (^)(CTAPIBaseManager *))failCallback
118 | {
119 | self.successBlock = successCallback;
120 | self.failBlock = failCallback;
121 |
122 | return [self loadDataWithParams:params];
123 | }
124 |
125 | - (NSInteger)loadDataWithParams:(NSDictionary *)params
126 | {
127 | NSInteger requestId = 0;
128 | NSDictionary *reformedParams = [self reformParams:params];
129 | if (reformedParams == nil) {
130 | reformedParams = @{};
131 | }
132 | if ([self shouldCallAPIWithParams:reformedParams]) {
133 | CTAPIManagerErrorType errorType = [self.validator manager:self isCorrectWithParamsData:reformedParams];
134 | if (errorType == CTAPIManagerErrorTypeNoError) {
135 |
136 | CTURLResponse *response = nil;
137 | // 先检查一下是否有内存缓存
138 | if ((self.cachePolicy & CTAPIManagerCachePolicyMemory) && self.shouldIgnoreCache == NO) {
139 | response = [[CTCacheCenter sharedInstance] fetchMemoryCacheWithServiceIdentifier:self.child.serviceIdentifier methodName:self.child.methodName params:reformedParams];
140 | }
141 |
142 | // 再检查是否有磁盘缓存
143 | if ((self.cachePolicy & CTAPIManagerCachePolicyDisk) && self.shouldIgnoreCache == NO) {
144 | response = [[CTCacheCenter sharedInstance] fetchDiskCacheWithServiceIdentifier:self.child.serviceIdentifier methodName:self.child.methodName params:reformedParams];
145 | }
146 |
147 | if (response != nil) {
148 | [self successedOnCallingAPI:response];
149 | return 0;
150 | }
151 |
152 | // 实际的网络请求
153 | if ([self isReachable]) {
154 | self.isLoading = YES;
155 |
156 | id service = [[CTServiceFactory sharedInstance] serviceWithIdentifier:self.child.serviceIdentifier];
157 | NSURLRequest *request = [service requestWithParams:reformedParams methodName:self.child.methodName requestType:self.child.requestType];
158 | request.service = service;
159 | [CTLogger logDebugInfoWithRequest:request apiName:self.child.methodName service:service];
160 |
161 | NSNumber *requestId = [[CTApiProxy sharedInstance] callApiWithRequest:request success:^(CTURLResponse *response) {
162 | [self successedOnCallingAPI:response];
163 | } fail:^(CTURLResponse *response) {
164 | CTAPIManagerErrorType errorType = CTAPIManagerErrorTypeDefault;
165 | if (response.status == CTURLResponseStatusErrorCancel) {
166 | errorType = CTAPIManagerErrorTypeCanceled;
167 | }
168 | if (response.status == CTURLResponseStatusErrorTimeout) {
169 | errorType = CTAPIManagerErrorTypeTimeout;
170 | }
171 | if (response.status == CTURLResponseStatusErrorNoNetwork) {
172 | errorType = CTAPIManagerErrorTypeNoNetWork;
173 | }
174 | [self failedOnCallingAPI:response withErrorType:errorType];
175 | }];
176 | [self.requestIdList addObject:requestId];
177 |
178 | NSMutableDictionary *params = [reformedParams mutableCopy];
179 | params[kCTAPIBaseManagerRequestID] = requestId;
180 | [self afterCallingAPIWithParams:params];
181 | return [requestId integerValue];
182 |
183 | } else {
184 | [self failedOnCallingAPI:nil withErrorType:CTAPIManagerErrorTypeNoNetWork];
185 | return requestId;
186 | }
187 | } else {
188 | [self failedOnCallingAPI:nil withErrorType:errorType];
189 | return requestId;
190 | }
191 | }
192 | return requestId;
193 | }
194 |
195 | #pragma mark - api callbacks
196 | - (void)successedOnCallingAPI:(CTURLResponse *)response
197 | {
198 |
199 | self.isLoading = NO;
200 | self.response = response;
201 |
202 | if (response.content) {
203 | self.fetchedRawData = [response.content copy];
204 | } else {
205 | self.fetchedRawData = [response.responseData copy];
206 | }
207 |
208 | [self removeRequestIdWithRequestID:response.requestId];
209 |
210 | CTAPIManagerErrorType errorType = [self.validator manager:self isCorrectWithCallBackData:response.content];
211 | if (errorType == CTAPIManagerErrorTypeNoError) {
212 |
213 | if (self.cachePolicy != CTAPIManagerCachePolicyNoCache && response.isCache == NO) {
214 | if (self.cachePolicy & CTAPIManagerCachePolicyMemory) {
215 | [[CTCacheCenter sharedInstance] saveMemoryCacheWithResponse:response
216 | serviceIdentifier:self.child.serviceIdentifier
217 | methodName:self.child.methodName
218 | cacheTime:self.memoryCacheSecond];
219 | }
220 |
221 | if (self.cachePolicy & CTAPIManagerCachePolicyDisk) {
222 | [[CTCacheCenter sharedInstance] saveDiskCacheWithResponse:response
223 | serviceIdentifier:self.child.serviceIdentifier
224 | methodName:self.child.methodName
225 | cacheTime:self.diskCacheSecond];
226 | }
227 | }
228 |
229 | if ([self.interceptor respondsToSelector:@selector(manager:didReceiveResponse:)]) {
230 | [self.interceptor manager:self didReceiveResponse:response];
231 | }
232 | if ([self beforePerformSuccessWithResponse:response]) {
233 | dispatch_async(dispatch_get_main_queue(), ^{
234 | if ([self.delegate respondsToSelector:@selector(managerCallAPIDidSuccess:)]) {
235 | [self.delegate managerCallAPIDidSuccess:self];
236 | }
237 | if (self.successBlock) {
238 | self.successBlock(self);
239 | }
240 | });
241 | }
242 | [self afterPerformSuccessWithResponse:response];
243 | } else {
244 | [self failedOnCallingAPI:response withErrorType:errorType];
245 | }
246 | }
247 |
248 | - (void)failedOnCallingAPI:(CTURLResponse *)response withErrorType:(CTAPIManagerErrorType)errorType
249 | {
250 | self.isLoading = NO;
251 | if (response) {
252 | self.response = response;
253 | }
254 | self.errorType = errorType;
255 | [self removeRequestIdWithRequestID:response.requestId];
256 |
257 | // 可以自动处理的错误
258 | // user token 无效,重新登录
259 | if (errorType == CTAPIManagerErrorTypeNeedLogin) {
260 | [[NSNotificationCenter defaultCenter] postNotificationName:kCTUserTokenIllegalNotification
261 | object:nil
262 | userInfo:@{
263 | kCTUserTokenNotificationUserInfoKeyManagerToContinue:self
264 | }];
265 | return;
266 | }
267 |
268 | // 可以自动处理的错误
269 | // user token 过期,重新刷新
270 | if (errorType == CTAPIManagerErrorTypeNeedAccessToken) {
271 | [[NSNotificationCenter defaultCenter] postNotificationName:kCTUserTokenInvalidNotification
272 | object:nil
273 | userInfo:@{
274 | kCTUserTokenNotificationUserInfoKeyManagerToContinue:self
275 | }];
276 | return;
277 | }
278 |
279 | id service = [[CTServiceFactory sharedInstance] serviceWithIdentifier:self.child.serviceIdentifier];
280 | BOOL shouldContinue = [service handleCommonErrorWithResponse:response manager:self errorType:errorType];
281 | if (shouldContinue == NO) {
282 | return;
283 | }
284 |
285 | // 常规错误
286 | if (errorType == CTAPIManagerErrorTypeNoNetWork) {
287 | self.errorMessage = @"无网络连接,请检查网络";
288 | }
289 | if (errorType == CTAPIManagerErrorTypeTimeout) {
290 | self.errorMessage = @"请求超时";
291 | }
292 | if (errorType == CTAPIManagerErrorTypeCanceled) {
293 | self.errorMessage = @"您已取消";
294 | }
295 | if (errorType == CTAPIManagerErrorTypeDownGrade) {
296 | self.errorMessage = @"网络拥塞";
297 | }
298 |
299 | // 其他错误
300 | dispatch_async(dispatch_get_main_queue(), ^{
301 | if ([self.interceptor respondsToSelector:@selector(manager:didReceiveResponse:)]) {
302 | [self.interceptor manager:self didReceiveResponse:response];
303 | }
304 | if ([self beforePerformFailWithResponse:response]) {
305 | [self.delegate managerCallAPIDidFailed:self];
306 | }
307 | if (self.failBlock) {
308 | self.failBlock(self);
309 | }
310 | [self afterPerformFailWithResponse:response];
311 | });
312 | }
313 |
314 | #pragma mark - method for interceptor
315 |
316 | /*
317 | 拦截器的功能可以由子类通过继承实现,也可以由其它对象实现,两种做法可以共存
318 | 当两种情况共存的时候,子类重载的方法一定要调用一下super
319 | 然后它们的调用顺序是BaseManager会先调用子类重载的实现,再调用外部interceptor的实现
320 |
321 | notes:
322 | 正常情况下,拦截器是通过代理的方式实现的,因此可以不需要以下这些代码
323 | 但是为了将来拓展方便,如果在调用拦截器之前manager又希望自己能够先做一些事情,所以这些方法还是需要能够被继承重载的
324 | 所有重载的方法,都要调用一下super,这样才能保证外部interceptor能够被调到
325 | 这就是decorate pattern
326 | */
327 | - (BOOL)beforePerformSuccessWithResponse:(CTURLResponse *)response
328 | {
329 | BOOL result = YES;
330 |
331 | self.errorType = CTAPIManagerErrorTypeSuccess;
332 | if ((NSInteger)self != (NSInteger)self.interceptor && [self.interceptor respondsToSelector:@selector(manager: beforePerformSuccessWithResponse:)]) {
333 | result = [self.interceptor manager:self beforePerformSuccessWithResponse:response];
334 | }
335 | return result;
336 | }
337 |
338 | - (void)afterPerformSuccessWithResponse:(CTURLResponse *)response
339 | {
340 | if ((NSInteger)self != (NSInteger)self.interceptor && [self.interceptor respondsToSelector:@selector(manager:afterPerformSuccessWithResponse:)]) {
341 | [self.interceptor manager:self afterPerformSuccessWithResponse:response];
342 | }
343 | }
344 |
345 | - (BOOL)beforePerformFailWithResponse:(CTURLResponse *)response
346 | {
347 | BOOL result = YES;
348 | if ((NSInteger)self != (NSInteger)self.interceptor && [self.interceptor respondsToSelector:@selector(manager:beforePerformFailWithResponse:)]) {
349 | result = [self.interceptor manager:self beforePerformFailWithResponse:response];
350 | }
351 | return result;
352 | }
353 |
354 | - (void)afterPerformFailWithResponse:(CTURLResponse *)response
355 | {
356 | if ((NSInteger)self != (NSInteger)self.interceptor && [self.interceptor respondsToSelector:@selector(manager:afterPerformFailWithResponse:)]) {
357 | [self.interceptor manager:self afterPerformFailWithResponse:response];
358 | }
359 | }
360 |
361 | //只有返回YES才会继续调用API
362 | - (BOOL)shouldCallAPIWithParams:(NSDictionary *)params
363 | {
364 | if ((NSInteger)self != (NSInteger)self.interceptor && [self.interceptor respondsToSelector:@selector(manager:shouldCallAPIWithParams:)]) {
365 | return [self.interceptor manager:self shouldCallAPIWithParams:params];
366 | } else {
367 | return YES;
368 | }
369 | }
370 |
371 | - (void)afterCallingAPIWithParams:(NSDictionary *)params
372 | {
373 | if ((NSInteger)self != (NSInteger)self.interceptor && [self.interceptor respondsToSelector:@selector(manager:afterCallingAPIWithParams:)]) {
374 | [self.interceptor manager:self afterCallingAPIWithParams:params];
375 | }
376 | }
377 |
378 | #pragma mark - method for child
379 | - (void)cleanData
380 | {
381 | self.fetchedRawData = nil;
382 | self.errorType = CTAPIManagerErrorTypeDefault;
383 | }
384 |
385 | //如果需要在调用API之前额外添加一些参数,比如pageNumber和pageSize之类的就在这里添加
386 | //子类中覆盖这个函数的时候就不需要调用[super reformParams:params]了
387 | - (NSDictionary *)reformParams:(NSDictionary *)params
388 | {
389 | IMP childIMP = [self.child methodForSelector:@selector(reformParams:)];
390 | IMP selfIMP = [self methodForSelector:@selector(reformParams:)];
391 |
392 | if (childIMP == selfIMP) {
393 | return params;
394 | } else {
395 | // 如果child是继承得来的,那么这里就不会跑到,会直接跑子类中的IMP。
396 | // 如果child是另一个对象,就会跑到这里
397 | NSDictionary *result = nil;
398 | result = [self.child reformParams:params];
399 | if (result) {
400 | return result;
401 | } else {
402 | return params;
403 | }
404 | }
405 | }
406 |
407 | #pragma mark - private methods
408 | - (void)removeRequestIdWithRequestID:(NSInteger)requestId
409 | {
410 | NSNumber *requestIDToRemove = nil;
411 | for (NSNumber *storedRequestId in self.requestIdList) {
412 | if ([storedRequestId integerValue] == requestId) {
413 | requestIDToRemove = storedRequestId;
414 | }
415 | }
416 | if (requestIDToRemove) {
417 | [self.requestIdList removeObject:requestIDToRemove];
418 | }
419 | }
420 |
421 | #pragma mark - getters and setters
422 | - (NSMutableArray *)requestIdList
423 | {
424 | if (_requestIdList == nil) {
425 | _requestIdList = [[NSMutableArray alloc] init];
426 | }
427 | return _requestIdList;
428 | }
429 |
430 | - (BOOL)isReachable
431 | {
432 | BOOL isReachability = [[CTMediator sharedInstance] CTNetworking_isReachable];
433 | if (!isReachability) {
434 | self.errorType = CTAPIManagerErrorTypeNoNetWork;
435 | }
436 | return isReachability;
437 | }
438 |
439 | - (BOOL)isLoading
440 | {
441 | if (self.requestIdList.count == 0) {
442 | _isLoading = NO;
443 | }
444 | return _isLoading;
445 | }
446 |
447 | @end
448 |
--------------------------------------------------------------------------------
/CTNetworking.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 48;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 4A1E178B2045560D00BDBF7B /* NSArray+AXNetworkingMethods.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A1E17782045560D00BDBF7B /* NSArray+AXNetworkingMethods.m */; };
11 | 4A1E178D2045560D00BDBF7B /* NSDictionary+AXNetworkingMethods.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A1E177E2045560D00BDBF7B /* NSDictionary+AXNetworkingMethods.m */; };
12 | 4A1E178E2045560D00BDBF7B /* NSURLRequest+CTNetworkingMethods.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A1E17822045560D00BDBF7B /* NSURLRequest+CTNetworkingMethods.m */; };
13 | 4A1E178F2045560D00BDBF7B /* NSMutableString+AXNetworkingMethods.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A1E17842045560D00BDBF7B /* NSMutableString+AXNetworkingMethods.m */; };
14 | 4A1E17902045560D00BDBF7B /* NSString+AXNetworkingMethods.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A1E17852045560D00BDBF7B /* NSString+AXNetworkingMethods.m */; };
15 | 4A1E17912045560D00BDBF7B /* NSObject+AXNetworkingMethods.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A1E17892045560D00BDBF7B /* NSObject+AXNetworkingMethods.m */; };
16 | 4A1E17B62045585A00BDBF7B /* CTLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A1E17952045585A00BDBF7B /* CTLogger.m */; };
17 | 4A1E17B72045585A00BDBF7B /* CTURLResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A1E17982045585A00BDBF7B /* CTURLResponse.m */; };
18 | 4A1E17B92045585A00BDBF7B /* Target_H5API.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A1E179E2045585A00BDBF7B /* Target_H5API.m */; };
19 | 4A1E17BA2045585A00BDBF7B /* CTAPIBaseManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A1E17A12045585A00BDBF7B /* CTAPIBaseManager.m */; };
20 | 4A1E17BB2045585A00BDBF7B /* iPhoneTypeDefine.plist in Resources */ = {isa = PBXBuildFile; fileRef = 4A1E17A32045585A00BDBF7B /* iPhoneTypeDefine.plist */; };
21 | 4A1E17BD2045585A00BDBF7B /* CTApiProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A1E17A92045585A00BDBF7B /* CTApiProxy.m */; };
22 | 4A1E17BE2045585A00BDBF7B /* CTCacheCenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A1E17AB2045585A00BDBF7B /* CTCacheCenter.m */; };
23 | 4A1E17BF2045585A00BDBF7B /* CTMemoryCacheDataCenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A1E17AD2045585A00BDBF7B /* CTMemoryCacheDataCenter.m */; };
24 | 4A1E17C02045585A00BDBF7B /* CTMemoryCachedRecord.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A1E17B02045585A00BDBF7B /* CTMemoryCachedRecord.m */; };
25 | 4A1E17C12045585A00BDBF7B /* CTDiskCacheCenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A1E17B42045585A00BDBF7B /* CTDiskCacheCenter.m */; };
26 | 4A1E17CB2045588E00BDBF7B /* CTServiceFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A1E17C92045588E00BDBF7B /* CTServiceFactory.m */; };
27 | 4AB2FB0A204586E400770EF1 /* Target_CTAppContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AB2FB09204586E400770EF1 /* Target_CTAppContext.m */; };
28 | 4AB2FB0D204586F900770EF1 /* Target_DemoService.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AB2FB0C204586F900770EF1 /* Target_DemoService.m */; };
29 | 4AB2FB1720458C7200770EF1 /* CTMediator+CTAppContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AB2FB1620458C7200770EF1 /* CTMediator+CTAppContext.m */; };
30 | 4AB2FB1D2045B03F00770EF1 /* DemoService.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AB2FB1C2045B03F00770EF1 /* DemoService.m */; };
31 | 4AE4F2F02045C69E002FF604 /* DemoAPIManagerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AE4F2EC2045C69E002FF604 /* DemoAPIManagerViewController.m */; };
32 | 4AE4F2F12045C69E002FF604 /* DemoAPIManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AE4F2EF2045C69E002FF604 /* DemoAPIManager.m */; };
33 | 4AF1D17A20454C4C006736EF /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AF1D17920454C4C006736EF /* AppDelegate.m */; };
34 | 4AF1D17D20454C4C006736EF /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AF1D17C20454C4C006736EF /* ViewController.m */; };
35 | 4AF1D18020454C4C006736EF /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4AF1D17E20454C4C006736EF /* Main.storyboard */; };
36 | 4AF1D18220454C4C006736EF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4AF1D18120454C4C006736EF /* Assets.xcassets */; };
37 | 4AF1D18520454C4C006736EF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4AF1D18320454C4C006736EF /* LaunchScreen.storyboard */; };
38 | 4AF1D18820454C4C006736EF /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AF1D18720454C4C006736EF /* main.m */; };
39 | ACA6BF36968B948431EBBED5 /* libPods-CTNetworking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2C89AC4DE62717E44D715D01 /* libPods-CTNetworking.a */; };
40 | /* End PBXBuildFile section */
41 |
42 | /* Begin PBXFileReference section */
43 | 004A387B2F0C26B746C0D43D /* Pods-CTNetworking.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CTNetworking.release.xcconfig"; path = "Pods/Target Support Files/Pods-CTNetworking/Pods-CTNetworking.release.xcconfig"; sourceTree = ""; };
44 | 2C89AC4DE62717E44D715D01 /* libPods-CTNetworking.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-CTNetworking.a"; sourceTree = BUILT_PRODUCTS_DIR; };
45 | 4A1E17782045560D00BDBF7B /* NSArray+AXNetworkingMethods.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSArray+AXNetworkingMethods.m"; sourceTree = ""; };
46 | 4A1E17792045560D00BDBF7B /* NSArray+AXNetworkingMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+AXNetworkingMethods.h"; sourceTree = ""; };
47 | 4A1E177E2045560D00BDBF7B /* NSDictionary+AXNetworkingMethods.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+AXNetworkingMethods.m"; sourceTree = ""; };
48 | 4A1E177F2045560D00BDBF7B /* NSDictionary+AXNetworkingMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+AXNetworkingMethods.h"; sourceTree = ""; };
49 | 4A1E17812045560D00BDBF7B /* NSURLRequest+CTNetworkingMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSURLRequest+CTNetworkingMethods.h"; sourceTree = ""; };
50 | 4A1E17822045560D00BDBF7B /* NSURLRequest+CTNetworkingMethods.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSURLRequest+CTNetworkingMethods.m"; sourceTree = ""; };
51 | 4A1E17842045560D00BDBF7B /* NSMutableString+AXNetworkingMethods.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableString+AXNetworkingMethods.m"; sourceTree = ""; };
52 | 4A1E17852045560D00BDBF7B /* NSString+AXNetworkingMethods.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+AXNetworkingMethods.m"; sourceTree = ""; };
53 | 4A1E17862045560D00BDBF7B /* NSString+AXNetworkingMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+AXNetworkingMethods.h"; sourceTree = ""; };
54 | 4A1E17872045560D00BDBF7B /* NSMutableString+AXNetworkingMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableString+AXNetworkingMethods.h"; sourceTree = ""; };
55 | 4A1E17892045560D00BDBF7B /* NSObject+AXNetworkingMethods.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+AXNetworkingMethods.m"; sourceTree = ""; };
56 | 4A1E178A2045560D00BDBF7B /* NSObject+AXNetworkingMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+AXNetworkingMethods.h"; sourceTree = ""; };
57 | 4A1E17942045585A00BDBF7B /* CTLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTLogger.h; sourceTree = ""; };
58 | 4A1E17952045585A00BDBF7B /* CTLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTLogger.m; sourceTree = ""; };
59 | 4A1E17972045585A00BDBF7B /* CTURLResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTURLResponse.h; sourceTree = ""; };
60 | 4A1E17982045585A00BDBF7B /* CTURLResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTURLResponse.m; sourceTree = ""; };
61 | 4A1E179E2045585A00BDBF7B /* Target_H5API.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Target_H5API.m; sourceTree = ""; };
62 | 4A1E179F2045585A00BDBF7B /* Target_H5API.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Target_H5API.h; sourceTree = ""; };
63 | 4A1E17A12045585A00BDBF7B /* CTAPIBaseManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTAPIBaseManager.m; sourceTree = ""; };
64 | 4A1E17A22045585A00BDBF7B /* CTAPIBaseManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTAPIBaseManager.h; sourceTree = ""; };
65 | 4A1E17A32045585A00BDBF7B /* iPhoneTypeDefine.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = iPhoneTypeDefine.plist; sourceTree = ""; };
66 | 4A1E17A52045585A00BDBF7B /* CTApiProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTApiProxy.h; sourceTree = ""; };
67 | 4A1E17A92045585A00BDBF7B /* CTApiProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTApiProxy.m; sourceTree = ""; };
68 | 4A1E17AB2045585A00BDBF7B /* CTCacheCenter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTCacheCenter.m; sourceTree = ""; };
69 | 4A1E17AD2045585A00BDBF7B /* CTMemoryCacheDataCenter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTMemoryCacheDataCenter.m; sourceTree = ""; };
70 | 4A1E17AE2045585A00BDBF7B /* CTMemoryCacheDataCenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTMemoryCacheDataCenter.h; sourceTree = ""; };
71 | 4A1E17B02045585A00BDBF7B /* CTMemoryCachedRecord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTMemoryCachedRecord.m; sourceTree = ""; };
72 | 4A1E17B12045585A00BDBF7B /* CTMemoryCachedRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTMemoryCachedRecord.h; sourceTree = ""; };
73 | 4A1E17B22045585A00BDBF7B /* CTCacheCenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTCacheCenter.h; sourceTree = ""; };
74 | 4A1E17B42045585A00BDBF7B /* CTDiskCacheCenter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTDiskCacheCenter.m; sourceTree = ""; };
75 | 4A1E17B52045585A00BDBF7B /* CTDiskCacheCenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTDiskCacheCenter.h; sourceTree = ""; };
76 | 4A1E17C72045588E00BDBF7B /* CTServiceProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTServiceProtocol.h; sourceTree = ""; };
77 | 4A1E17C82045588E00BDBF7B /* CTServiceFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTServiceFactory.h; sourceTree = ""; };
78 | 4A1E17C92045588E00BDBF7B /* CTServiceFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTServiceFactory.m; sourceTree = ""; };
79 | 4A1E17CC20455B4200BDBF7B /* CTNetworking.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CTNetworking.h; sourceTree = ""; };
80 | 4AB2FB08204586E400770EF1 /* Target_CTAppContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Target_CTAppContext.h; sourceTree = ""; };
81 | 4AB2FB09204586E400770EF1 /* Target_CTAppContext.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Target_CTAppContext.m; sourceTree = ""; };
82 | 4AB2FB0B204586F900770EF1 /* Target_DemoService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Target_DemoService.h; sourceTree = ""; };
83 | 4AB2FB0C204586F900770EF1 /* Target_DemoService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Target_DemoService.m; sourceTree = ""; };
84 | 4AB2FB112045890E00770EF1 /* CTNetworkingDefines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CTNetworkingDefines.h; sourceTree = ""; };
85 | 4AB2FB1520458C7200770EF1 /* CTMediator+CTAppContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CTMediator+CTAppContext.h"; sourceTree = ""; };
86 | 4AB2FB1620458C7200770EF1 /* CTMediator+CTAppContext.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "CTMediator+CTAppContext.m"; sourceTree = ""; };
87 | 4AB2FB1B2045B03F00770EF1 /* DemoService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DemoService.h; sourceTree = ""; };
88 | 4AB2FB1C2045B03F00770EF1 /* DemoService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DemoService.m; sourceTree = ""; };
89 | 4AE4F2EB2045C69E002FF604 /* DemoAPIManagerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemoAPIManagerViewController.h; sourceTree = ""; };
90 | 4AE4F2EC2045C69E002FF604 /* DemoAPIManagerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DemoAPIManagerViewController.m; sourceTree = ""; };
91 | 4AE4F2EE2045C69E002FF604 /* DemoAPIManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemoAPIManager.h; sourceTree = ""; };
92 | 4AE4F2EF2045C69E002FF604 /* DemoAPIManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DemoAPIManager.m; sourceTree = ""; };
93 | 4AF1D17520454C4C006736EF /* CTNetworking.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CTNetworking.app; sourceTree = BUILT_PRODUCTS_DIR; };
94 | 4AF1D17820454C4C006736EF /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
95 | 4AF1D17920454C4C006736EF /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
96 | 4AF1D17B20454C4C006736EF /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; };
97 | 4AF1D17C20454C4C006736EF /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; };
98 | 4AF1D17F20454C4C006736EF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
99 | 4AF1D18120454C4C006736EF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
100 | 4AF1D18420454C4C006736EF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
101 | 4AF1D18620454C4C006736EF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
102 | 4AF1D18720454C4C006736EF /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
103 | 615C4C6F1B9800EECABF0C74 /* Pods-CTNetworking.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CTNetworking.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CTNetworking/Pods-CTNetworking.debug.xcconfig"; sourceTree = ""; };
104 | /* End PBXFileReference section */
105 |
106 | /* Begin PBXFrameworksBuildPhase section */
107 | 4AF1D17220454C4C006736EF /* Frameworks */ = {
108 | isa = PBXFrameworksBuildPhase;
109 | buildActionMask = 2147483647;
110 | files = (
111 | ACA6BF36968B948431EBBED5 /* libPods-CTNetworking.a in Frameworks */,
112 | );
113 | runOnlyForDeploymentPostprocessing = 0;
114 | };
115 | /* End PBXFrameworksBuildPhase section */
116 |
117 | /* Begin PBXGroup section */
118 | 4A1E17752045549100BDBF7B /* CTNetworking */ = {
119 | isa = PBXGroup;
120 | children = (
121 | 4A1E17C62045588E00BDBF7B /* Services */,
122 | 4A1E17922045585A00BDBF7B /* Components */,
123 | 4A1E17762045560D00BDBF7B /* Categories */,
124 | 4A1E17CC20455B4200BDBF7B /* CTNetworking.h */,
125 | 4AB2FB112045890E00770EF1 /* CTNetworkingDefines.h */,
126 | );
127 | path = CTNetworking;
128 | sourceTree = "";
129 | };
130 | 4A1E17762045560D00BDBF7B /* Categories */ = {
131 | isa = PBXGroup;
132 | children = (
133 | 4AB2FB1220458C5D00770EF1 /* CTMediator */,
134 | 4A1E17772045560D00BDBF7B /* Array */,
135 | 4A1E177D2045560D00BDBF7B /* Dictionary */,
136 | 4A1E17802045560D00BDBF7B /* NSURLRequest */,
137 | 4A1E17832045560D00BDBF7B /* String */,
138 | 4A1E17882045560D00BDBF7B /* NSObject */,
139 | );
140 | path = Categories;
141 | sourceTree = "";
142 | };
143 | 4A1E17772045560D00BDBF7B /* Array */ = {
144 | isa = PBXGroup;
145 | children = (
146 | 4A1E17782045560D00BDBF7B /* NSArray+AXNetworkingMethods.m */,
147 | 4A1E17792045560D00BDBF7B /* NSArray+AXNetworkingMethods.h */,
148 | );
149 | path = Array;
150 | sourceTree = "";
151 | };
152 | 4A1E177D2045560D00BDBF7B /* Dictionary */ = {
153 | isa = PBXGroup;
154 | children = (
155 | 4A1E177E2045560D00BDBF7B /* NSDictionary+AXNetworkingMethods.m */,
156 | 4A1E177F2045560D00BDBF7B /* NSDictionary+AXNetworkingMethods.h */,
157 | );
158 | path = Dictionary;
159 | sourceTree = "";
160 | };
161 | 4A1E17802045560D00BDBF7B /* NSURLRequest */ = {
162 | isa = PBXGroup;
163 | children = (
164 | 4A1E17812045560D00BDBF7B /* NSURLRequest+CTNetworkingMethods.h */,
165 | 4A1E17822045560D00BDBF7B /* NSURLRequest+CTNetworkingMethods.m */,
166 | );
167 | path = NSURLRequest;
168 | sourceTree = "";
169 | };
170 | 4A1E17832045560D00BDBF7B /* String */ = {
171 | isa = PBXGroup;
172 | children = (
173 | 4A1E17842045560D00BDBF7B /* NSMutableString+AXNetworkingMethods.m */,
174 | 4A1E17852045560D00BDBF7B /* NSString+AXNetworkingMethods.m */,
175 | 4A1E17862045560D00BDBF7B /* NSString+AXNetworkingMethods.h */,
176 | 4A1E17872045560D00BDBF7B /* NSMutableString+AXNetworkingMethods.h */,
177 | );
178 | path = String;
179 | sourceTree = "";
180 | };
181 | 4A1E17882045560D00BDBF7B /* NSObject */ = {
182 | isa = PBXGroup;
183 | children = (
184 | 4A1E17892045560D00BDBF7B /* NSObject+AXNetworkingMethods.m */,
185 | 4A1E178A2045560D00BDBF7B /* NSObject+AXNetworkingMethods.h */,
186 | );
187 | path = NSObject;
188 | sourceTree = "";
189 | };
190 | 4A1E17922045585A00BDBF7B /* Components */ = {
191 | isa = PBXGroup;
192 | children = (
193 | 4A1E17932045585A00BDBF7B /* LogComponents */,
194 | 4A1E17962045585A00BDBF7B /* URLResponse */,
195 | 4A1E17992045585A00BDBF7B /* BaseAPITarget */,
196 | 4A1E17A02045585A00BDBF7B /* BaseAPIManager */,
197 | 4A1E17A32045585A00BDBF7B /* iPhoneTypeDefine.plist */,
198 | 4A1E17A42045585A00BDBF7B /* APIProxy */,
199 | 4A1E17AA2045585A00BDBF7B /* CacheComponents */,
200 | );
201 | path = Components;
202 | sourceTree = "";
203 | };
204 | 4A1E17932045585A00BDBF7B /* LogComponents */ = {
205 | isa = PBXGroup;
206 | children = (
207 | 4A1E17942045585A00BDBF7B /* CTLogger.h */,
208 | 4A1E17952045585A00BDBF7B /* CTLogger.m */,
209 | );
210 | path = LogComponents;
211 | sourceTree = "";
212 | };
213 | 4A1E17962045585A00BDBF7B /* URLResponse */ = {
214 | isa = PBXGroup;
215 | children = (
216 | 4A1E17972045585A00BDBF7B /* CTURLResponse.h */,
217 | 4A1E17982045585A00BDBF7B /* CTURLResponse.m */,
218 | );
219 | path = URLResponse;
220 | sourceTree = "";
221 | };
222 | 4A1E17992045585A00BDBF7B /* BaseAPITarget */ = {
223 | isa = PBXGroup;
224 | children = (
225 | 4A1E179D2045585A00BDBF7B /* H5API */,
226 | );
227 | path = BaseAPITarget;
228 | sourceTree = "";
229 | };
230 | 4A1E179D2045585A00BDBF7B /* H5API */ = {
231 | isa = PBXGroup;
232 | children = (
233 | 4A1E179E2045585A00BDBF7B /* Target_H5API.m */,
234 | 4A1E179F2045585A00BDBF7B /* Target_H5API.h */,
235 | );
236 | path = H5API;
237 | sourceTree = "";
238 | };
239 | 4A1E17A02045585A00BDBF7B /* BaseAPIManager */ = {
240 | isa = PBXGroup;
241 | children = (
242 | 4A1E17A12045585A00BDBF7B /* CTAPIBaseManager.m */,
243 | 4A1E17A22045585A00BDBF7B /* CTAPIBaseManager.h */,
244 | );
245 | path = BaseAPIManager;
246 | sourceTree = "";
247 | };
248 | 4A1E17A42045585A00BDBF7B /* APIProxy */ = {
249 | isa = PBXGroup;
250 | children = (
251 | 4A1E17A52045585A00BDBF7B /* CTApiProxy.h */,
252 | 4A1E17A92045585A00BDBF7B /* CTApiProxy.m */,
253 | );
254 | path = APIProxy;
255 | sourceTree = "";
256 | };
257 | 4A1E17AA2045585A00BDBF7B /* CacheComponents */ = {
258 | isa = PBXGroup;
259 | children = (
260 | 4A1E17B22045585A00BDBF7B /* CTCacheCenter.h */,
261 | 4A1E17AB2045585A00BDBF7B /* CTCacheCenter.m */,
262 | 4A1E17AC2045585A00BDBF7B /* MemCacheDataCenter */,
263 | 4A1E17B32045585A00BDBF7B /* DiskCacheDataCenter */,
264 | );
265 | path = CacheComponents;
266 | sourceTree = "";
267 | };
268 | 4A1E17AC2045585A00BDBF7B /* MemCacheDataCenter */ = {
269 | isa = PBXGroup;
270 | children = (
271 | 4A1E17AD2045585A00BDBF7B /* CTMemoryCacheDataCenter.m */,
272 | 4A1E17AE2045585A00BDBF7B /* CTMemoryCacheDataCenter.h */,
273 | 4A1E17AF2045585A00BDBF7B /* MemoryCachedRecord */,
274 | );
275 | path = MemCacheDataCenter;
276 | sourceTree = "";
277 | };
278 | 4A1E17AF2045585A00BDBF7B /* MemoryCachedRecord */ = {
279 | isa = PBXGroup;
280 | children = (
281 | 4A1E17B02045585A00BDBF7B /* CTMemoryCachedRecord.m */,
282 | 4A1E17B12045585A00BDBF7B /* CTMemoryCachedRecord.h */,
283 | );
284 | path = MemoryCachedRecord;
285 | sourceTree = "";
286 | };
287 | 4A1E17B32045585A00BDBF7B /* DiskCacheDataCenter */ = {
288 | isa = PBXGroup;
289 | children = (
290 | 4A1E17B42045585A00BDBF7B /* CTDiskCacheCenter.m */,
291 | 4A1E17B52045585A00BDBF7B /* CTDiskCacheCenter.h */,
292 | );
293 | path = DiskCacheDataCenter;
294 | sourceTree = "";
295 | };
296 | 4A1E17C62045588E00BDBF7B /* Services */ = {
297 | isa = PBXGroup;
298 | children = (
299 | 4A1E17C72045588E00BDBF7B /* CTServiceProtocol.h */,
300 | 4A1E17C82045588E00BDBF7B /* CTServiceFactory.h */,
301 | 4A1E17C92045588E00BDBF7B /* CTServiceFactory.m */,
302 | );
303 | path = Services;
304 | sourceTree = "";
305 | };
306 | 4A4A07BB2045BDE2001A54C6 /* DemoControllers */ = {
307 | isa = PBXGroup;
308 | children = (
309 | 4AE4F2EA2045C69E002FF604 /* DemoAPIManagerViewController */,
310 | );
311 | path = DemoControllers;
312 | sourceTree = "";
313 | };
314 | 4AB2FB04204586C400770EF1 /* Demo */ = {
315 | isa = PBXGroup;
316 | children = (
317 | 4A4A07BB2045BDE2001A54C6 /* DemoControllers */,
318 | 4AB2FB05204586C400770EF1 /* DemoService */,
319 | 4AB2FB06204586C400770EF1 /* DemoAppContext */,
320 | );
321 | path = Demo;
322 | sourceTree = "";
323 | };
324 | 4AB2FB05204586C400770EF1 /* DemoService */ = {
325 | isa = PBXGroup;
326 | children = (
327 | 4AB2FB0B204586F900770EF1 /* Target_DemoService.h */,
328 | 4AB2FB0C204586F900770EF1 /* Target_DemoService.m */,
329 | 4AB2FB1B2045B03F00770EF1 /* DemoService.h */,
330 | 4AB2FB1C2045B03F00770EF1 /* DemoService.m */,
331 | );
332 | path = DemoService;
333 | sourceTree = "";
334 | };
335 | 4AB2FB06204586C400770EF1 /* DemoAppContext */ = {
336 | isa = PBXGroup;
337 | children = (
338 | 4AB2FB08204586E400770EF1 /* Target_CTAppContext.h */,
339 | 4AB2FB09204586E400770EF1 /* Target_CTAppContext.m */,
340 | );
341 | path = DemoAppContext;
342 | sourceTree = "";
343 | };
344 | 4AB2FB1220458C5D00770EF1 /* CTMediator */ = {
345 | isa = PBXGroup;
346 | children = (
347 | 4AB2FB1320458C5D00770EF1 /* AppContext */,
348 | );
349 | path = CTMediator;
350 | sourceTree = "";
351 | };
352 | 4AB2FB1320458C5D00770EF1 /* AppContext */ = {
353 | isa = PBXGroup;
354 | children = (
355 | 4AB2FB1520458C7200770EF1 /* CTMediator+CTAppContext.h */,
356 | 4AB2FB1620458C7200770EF1 /* CTMediator+CTAppContext.m */,
357 | );
358 | path = AppContext;
359 | sourceTree = "";
360 | };
361 | 4AE4F2EA2045C69E002FF604 /* DemoAPIManagerViewController */ = {
362 | isa = PBXGroup;
363 | children = (
364 | 4AE4F2ED2045C69E002FF604 /* DemoAPIManager */,
365 | 4AE4F2EB2045C69E002FF604 /* DemoAPIManagerViewController.h */,
366 | 4AE4F2EC2045C69E002FF604 /* DemoAPIManagerViewController.m */,
367 | );
368 | path = DemoAPIManagerViewController;
369 | sourceTree = "";
370 | };
371 | 4AE4F2ED2045C69E002FF604 /* DemoAPIManager */ = {
372 | isa = PBXGroup;
373 | children = (
374 | 4AE4F2EE2045C69E002FF604 /* DemoAPIManager.h */,
375 | 4AE4F2EF2045C69E002FF604 /* DemoAPIManager.m */,
376 | );
377 | path = DemoAPIManager;
378 | sourceTree = "";
379 | };
380 | 4AF1D16C20454C4C006736EF = {
381 | isa = PBXGroup;
382 | children = (
383 | 4AF1D17720454C4C006736EF /* CTNetworking */,
384 | 4AF1D17620454C4C006736EF /* Products */,
385 | 5898783C7B836C01FD39744F /* Pods */,
386 | 9CA092C16DCAE047AC413E6D /* Frameworks */,
387 | );
388 | sourceTree = "";
389 | };
390 | 4AF1D17620454C4C006736EF /* Products */ = {
391 | isa = PBXGroup;
392 | children = (
393 | 4AF1D17520454C4C006736EF /* CTNetworking.app */,
394 | );
395 | name = Products;
396 | sourceTree = "";
397 | };
398 | 4AF1D17720454C4C006736EF /* CTNetworking */ = {
399 | isa = PBXGroup;
400 | children = (
401 | 4A1E17752045549100BDBF7B /* CTNetworking */,
402 | 4AB2FB04204586C400770EF1 /* Demo */,
403 | 4AF1D17820454C4C006736EF /* AppDelegate.h */,
404 | 4AF1D17920454C4C006736EF /* AppDelegate.m */,
405 | 4AF1D17B20454C4C006736EF /* ViewController.h */,
406 | 4AF1D17C20454C4C006736EF /* ViewController.m */,
407 | 4AF1D17E20454C4C006736EF /* Main.storyboard */,
408 | 4AF1D18120454C4C006736EF /* Assets.xcassets */,
409 | 4AF1D18320454C4C006736EF /* LaunchScreen.storyboard */,
410 | 4AF1D18620454C4C006736EF /* Info.plist */,
411 | 4AF1D18720454C4C006736EF /* main.m */,
412 | );
413 | path = CTNetworking;
414 | sourceTree = "";
415 | };
416 | 5898783C7B836C01FD39744F /* Pods */ = {
417 | isa = PBXGroup;
418 | children = (
419 | 615C4C6F1B9800EECABF0C74 /* Pods-CTNetworking.debug.xcconfig */,
420 | 004A387B2F0C26B746C0D43D /* Pods-CTNetworking.release.xcconfig */,
421 | );
422 | name = Pods;
423 | sourceTree = "";
424 | };
425 | 9CA092C16DCAE047AC413E6D /* Frameworks */ = {
426 | isa = PBXGroup;
427 | children = (
428 | 2C89AC4DE62717E44D715D01 /* libPods-CTNetworking.a */,
429 | );
430 | name = Frameworks;
431 | sourceTree = "";
432 | };
433 | /* End PBXGroup section */
434 |
435 | /* Begin PBXNativeTarget section */
436 | 4AF1D17420454C4C006736EF /* CTNetworking */ = {
437 | isa = PBXNativeTarget;
438 | buildConfigurationList = 4AF1D18B20454C4C006736EF /* Build configuration list for PBXNativeTarget "CTNetworking" */;
439 | buildPhases = (
440 | 0B7170AD119EE9AA236C2859 /* [CP] Check Pods Manifest.lock */,
441 | 4AF1D17120454C4C006736EF /* Sources */,
442 | 4AF1D17220454C4C006736EF /* Frameworks */,
443 | 4AF1D17320454C4C006736EF /* Resources */,
444 | );
445 | buildRules = (
446 | );
447 | dependencies = (
448 | );
449 | name = CTNetworking;
450 | productName = CTNetworking;
451 | productReference = 4AF1D17520454C4C006736EF /* CTNetworking.app */;
452 | productType = "com.apple.product-type.application";
453 | };
454 | /* End PBXNativeTarget section */
455 |
456 | /* Begin PBXProject section */
457 | 4AF1D16D20454C4C006736EF /* Project object */ = {
458 | isa = PBXProject;
459 | attributes = {
460 | LastUpgradeCheck = 0920;
461 | ORGANIZATIONNAME = casa;
462 | TargetAttributes = {
463 | 4AF1D17420454C4C006736EF = {
464 | CreatedOnToolsVersion = 9.2;
465 | ProvisioningStyle = Automatic;
466 | };
467 | };
468 | };
469 | buildConfigurationList = 4AF1D17020454C4C006736EF /* Build configuration list for PBXProject "CTNetworking" */;
470 | compatibilityVersion = "Xcode 8.0";
471 | developmentRegion = en;
472 | hasScannedForEncodings = 0;
473 | knownRegions = (
474 | en,
475 | Base,
476 | );
477 | mainGroup = 4AF1D16C20454C4C006736EF;
478 | productRefGroup = 4AF1D17620454C4C006736EF /* Products */;
479 | projectDirPath = "";
480 | projectRoot = "";
481 | targets = (
482 | 4AF1D17420454C4C006736EF /* CTNetworking */,
483 | );
484 | };
485 | /* End PBXProject section */
486 |
487 | /* Begin PBXResourcesBuildPhase section */
488 | 4AF1D17320454C4C006736EF /* Resources */ = {
489 | isa = PBXResourcesBuildPhase;
490 | buildActionMask = 2147483647;
491 | files = (
492 | 4A1E17BB2045585A00BDBF7B /* iPhoneTypeDefine.plist in Resources */,
493 | 4AF1D18520454C4C006736EF /* LaunchScreen.storyboard in Resources */,
494 | 4AF1D18220454C4C006736EF /* Assets.xcassets in Resources */,
495 | 4AF1D18020454C4C006736EF /* Main.storyboard in Resources */,
496 | );
497 | runOnlyForDeploymentPostprocessing = 0;
498 | };
499 | /* End PBXResourcesBuildPhase section */
500 |
501 | /* Begin PBXShellScriptBuildPhase section */
502 | 0B7170AD119EE9AA236C2859 /* [CP] Check Pods Manifest.lock */ = {
503 | isa = PBXShellScriptBuildPhase;
504 | buildActionMask = 2147483647;
505 | files = (
506 | );
507 | inputPaths = (
508 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
509 | "${PODS_ROOT}/Manifest.lock",
510 | );
511 | name = "[CP] Check Pods Manifest.lock";
512 | outputPaths = (
513 | "$(DERIVED_FILE_DIR)/Pods-CTNetworking-checkManifestLockResult.txt",
514 | );
515 | runOnlyForDeploymentPostprocessing = 0;
516 | shellPath = /bin/sh;
517 | shellScript = "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";
518 | showEnvVarsInLog = 0;
519 | };
520 | /* End PBXShellScriptBuildPhase section */
521 |
522 | /* Begin PBXSourcesBuildPhase section */
523 | 4AF1D17120454C4C006736EF /* Sources */ = {
524 | isa = PBXSourcesBuildPhase;
525 | buildActionMask = 2147483647;
526 | files = (
527 | 4AE4F2F12045C69E002FF604 /* DemoAPIManager.m in Sources */,
528 | 4A1E178B2045560D00BDBF7B /* NSArray+AXNetworkingMethods.m in Sources */,
529 | 4AB2FB0D204586F900770EF1 /* Target_DemoService.m in Sources */,
530 | 4AE4F2F02045C69E002FF604 /* DemoAPIManagerViewController.m in Sources */,
531 | 4AB2FB0A204586E400770EF1 /* Target_CTAppContext.m in Sources */,
532 | 4A1E17BA2045585A00BDBF7B /* CTAPIBaseManager.m in Sources */,
533 | 4AF1D17D20454C4C006736EF /* ViewController.m in Sources */,
534 | 4A1E178F2045560D00BDBF7B /* NSMutableString+AXNetworkingMethods.m in Sources */,
535 | 4A1E17B72045585A00BDBF7B /* CTURLResponse.m in Sources */,
536 | 4AB2FB1D2045B03F00770EF1 /* DemoService.m in Sources */,
537 | 4A1E178E2045560D00BDBF7B /* NSURLRequest+CTNetworkingMethods.m in Sources */,
538 | 4A1E17902045560D00BDBF7B /* NSString+AXNetworkingMethods.m in Sources */,
539 | 4A1E17C02045585A00BDBF7B /* CTMemoryCachedRecord.m in Sources */,
540 | 4AB2FB1720458C7200770EF1 /* CTMediator+CTAppContext.m in Sources */,
541 | 4A1E17B62045585A00BDBF7B /* CTLogger.m in Sources */,
542 | 4A1E17BD2045585A00BDBF7B /* CTApiProxy.m in Sources */,
543 | 4A1E17BF2045585A00BDBF7B /* CTMemoryCacheDataCenter.m in Sources */,
544 | 4A1E17BE2045585A00BDBF7B /* CTCacheCenter.m in Sources */,
545 | 4A1E17B92045585A00BDBF7B /* Target_H5API.m in Sources */,
546 | 4A1E17CB2045588E00BDBF7B /* CTServiceFactory.m in Sources */,
547 | 4A1E17912045560D00BDBF7B /* NSObject+AXNetworkingMethods.m in Sources */,
548 | 4A1E178D2045560D00BDBF7B /* NSDictionary+AXNetworkingMethods.m in Sources */,
549 | 4A1E17C12045585A00BDBF7B /* CTDiskCacheCenter.m in Sources */,
550 | 4AF1D18820454C4C006736EF /* main.m in Sources */,
551 | 4AF1D17A20454C4C006736EF /* AppDelegate.m in Sources */,
552 | );
553 | runOnlyForDeploymentPostprocessing = 0;
554 | };
555 | /* End PBXSourcesBuildPhase section */
556 |
557 | /* Begin PBXVariantGroup section */
558 | 4AF1D17E20454C4C006736EF /* Main.storyboard */ = {
559 | isa = PBXVariantGroup;
560 | children = (
561 | 4AF1D17F20454C4C006736EF /* Base */,
562 | );
563 | name = Main.storyboard;
564 | sourceTree = "";
565 | };
566 | 4AF1D18320454C4C006736EF /* LaunchScreen.storyboard */ = {
567 | isa = PBXVariantGroup;
568 | children = (
569 | 4AF1D18420454C4C006736EF /* Base */,
570 | );
571 | name = LaunchScreen.storyboard;
572 | sourceTree = "";
573 | };
574 | /* End PBXVariantGroup section */
575 |
576 | /* Begin XCBuildConfiguration section */
577 | 4AF1D18920454C4C006736EF /* Debug */ = {
578 | isa = XCBuildConfiguration;
579 | buildSettings = {
580 | ALWAYS_SEARCH_USER_PATHS = NO;
581 | CLANG_ANALYZER_NONNULL = YES;
582 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
583 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
584 | CLANG_CXX_LIBRARY = "libc++";
585 | CLANG_ENABLE_MODULES = YES;
586 | CLANG_ENABLE_OBJC_ARC = YES;
587 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
588 | CLANG_WARN_BOOL_CONVERSION = YES;
589 | CLANG_WARN_COMMA = YES;
590 | CLANG_WARN_CONSTANT_CONVERSION = YES;
591 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
592 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
593 | CLANG_WARN_EMPTY_BODY = YES;
594 | CLANG_WARN_ENUM_CONVERSION = YES;
595 | CLANG_WARN_INFINITE_RECURSION = YES;
596 | CLANG_WARN_INT_CONVERSION = YES;
597 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
598 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
599 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
600 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
601 | CLANG_WARN_STRICT_PROTOTYPES = YES;
602 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
603 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
604 | CLANG_WARN_UNREACHABLE_CODE = YES;
605 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
606 | CODE_SIGN_IDENTITY = "iPhone Developer";
607 | COPY_PHASE_STRIP = NO;
608 | DEBUG_INFORMATION_FORMAT = dwarf;
609 | ENABLE_STRICT_OBJC_MSGSEND = YES;
610 | ENABLE_TESTABILITY = YES;
611 | GCC_C_LANGUAGE_STANDARD = gnu11;
612 | GCC_DYNAMIC_NO_PIC = NO;
613 | GCC_NO_COMMON_BLOCKS = YES;
614 | GCC_OPTIMIZATION_LEVEL = 0;
615 | GCC_PREPROCESSOR_DEFINITIONS = (
616 | "DEBUG=1",
617 | "$(inherited)",
618 | );
619 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
620 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
621 | GCC_WARN_UNDECLARED_SELECTOR = YES;
622 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
623 | GCC_WARN_UNUSED_FUNCTION = YES;
624 | GCC_WARN_UNUSED_VARIABLE = YES;
625 | IPHONEOS_DEPLOYMENT_TARGET = 11.2;
626 | MTL_ENABLE_DEBUG_INFO = YES;
627 | ONLY_ACTIVE_ARCH = YES;
628 | SDKROOT = iphoneos;
629 | };
630 | name = Debug;
631 | };
632 | 4AF1D18A20454C4C006736EF /* Release */ = {
633 | isa = XCBuildConfiguration;
634 | buildSettings = {
635 | ALWAYS_SEARCH_USER_PATHS = NO;
636 | CLANG_ANALYZER_NONNULL = YES;
637 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
638 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
639 | CLANG_CXX_LIBRARY = "libc++";
640 | CLANG_ENABLE_MODULES = YES;
641 | CLANG_ENABLE_OBJC_ARC = YES;
642 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
643 | CLANG_WARN_BOOL_CONVERSION = YES;
644 | CLANG_WARN_COMMA = YES;
645 | CLANG_WARN_CONSTANT_CONVERSION = YES;
646 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
647 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
648 | CLANG_WARN_EMPTY_BODY = YES;
649 | CLANG_WARN_ENUM_CONVERSION = YES;
650 | CLANG_WARN_INFINITE_RECURSION = YES;
651 | CLANG_WARN_INT_CONVERSION = YES;
652 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
653 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
654 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
655 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
656 | CLANG_WARN_STRICT_PROTOTYPES = YES;
657 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
658 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
659 | CLANG_WARN_UNREACHABLE_CODE = YES;
660 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
661 | CODE_SIGN_IDENTITY = "iPhone Developer";
662 | COPY_PHASE_STRIP = NO;
663 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
664 | ENABLE_NS_ASSERTIONS = NO;
665 | ENABLE_STRICT_OBJC_MSGSEND = YES;
666 | GCC_C_LANGUAGE_STANDARD = gnu11;
667 | GCC_NO_COMMON_BLOCKS = YES;
668 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
669 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
670 | GCC_WARN_UNDECLARED_SELECTOR = YES;
671 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
672 | GCC_WARN_UNUSED_FUNCTION = YES;
673 | GCC_WARN_UNUSED_VARIABLE = YES;
674 | IPHONEOS_DEPLOYMENT_TARGET = 11.2;
675 | MTL_ENABLE_DEBUG_INFO = NO;
676 | SDKROOT = iphoneos;
677 | VALIDATE_PRODUCT = YES;
678 | };
679 | name = Release;
680 | };
681 | 4AF1D18C20454C4C006736EF /* Debug */ = {
682 | isa = XCBuildConfiguration;
683 | baseConfigurationReference = 615C4C6F1B9800EECABF0C74 /* Pods-CTNetworking.debug.xcconfig */;
684 | buildSettings = {
685 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
686 | CODE_SIGN_STYLE = Automatic;
687 | DEVELOPMENT_TEAM = GQ7926NZY4;
688 | INFOPLIST_FILE = CTNetworking/Info.plist;
689 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
690 | PRODUCT_BUNDLE_IDENTIFIER = casa.CTNetworking;
691 | PRODUCT_NAME = "$(TARGET_NAME)";
692 | TARGETED_DEVICE_FAMILY = "1,2";
693 | };
694 | name = Debug;
695 | };
696 | 4AF1D18D20454C4C006736EF /* Release */ = {
697 | isa = XCBuildConfiguration;
698 | baseConfigurationReference = 004A387B2F0C26B746C0D43D /* Pods-CTNetworking.release.xcconfig */;
699 | buildSettings = {
700 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
701 | CODE_SIGN_STYLE = Automatic;
702 | DEVELOPMENT_TEAM = GQ7926NZY4;
703 | INFOPLIST_FILE = CTNetworking/Info.plist;
704 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
705 | PRODUCT_BUNDLE_IDENTIFIER = casa.CTNetworking;
706 | PRODUCT_NAME = "$(TARGET_NAME)";
707 | TARGETED_DEVICE_FAMILY = "1,2";
708 | };
709 | name = Release;
710 | };
711 | /* End XCBuildConfiguration section */
712 |
713 | /* Begin XCConfigurationList section */
714 | 4AF1D17020454C4C006736EF /* Build configuration list for PBXProject "CTNetworking" */ = {
715 | isa = XCConfigurationList;
716 | buildConfigurations = (
717 | 4AF1D18920454C4C006736EF /* Debug */,
718 | 4AF1D18A20454C4C006736EF /* Release */,
719 | );
720 | defaultConfigurationIsVisible = 0;
721 | defaultConfigurationName = Release;
722 | };
723 | 4AF1D18B20454C4C006736EF /* Build configuration list for PBXNativeTarget "CTNetworking" */ = {
724 | isa = XCConfigurationList;
725 | buildConfigurations = (
726 | 4AF1D18C20454C4C006736EF /* Debug */,
727 | 4AF1D18D20454C4C006736EF /* Release */,
728 | );
729 | defaultConfigurationIsVisible = 0;
730 | defaultConfigurationName = Release;
731 | };
732 | /* End XCConfigurationList section */
733 | };
734 | rootObject = 4AF1D16D20454C4C006736EF /* Project object */;
735 | }
736 |
--------------------------------------------------------------------------------