-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f968819
commit 771f3ce
Showing
34 changed files
with
120 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
*/ | ||
|
||
#import <UIKit/UIKit.h> | ||
@import UIKit; | ||
@class WTURLRequestOperation; | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#import <UIKit/UIKit.h> | ||
@import UIKit; | ||
|
||
|
||
@interface UIImage (WTRequestCenter) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ | |
*/ | ||
|
||
#import <UIKit/UIKit.h> | ||
@import UIKit; | ||
#import "WTRequestCenter.h" | ||
/* | ||
方便的图片缓存功能 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// WTURLSessionManager.h | ||
// WTRequestCenter | ||
// | ||
// Created by SongWentong on 8/31/15. | ||
// Copyright (c) 2015 song. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@interface WTURLSessionManager : NSObject | ||
@property (readonly, nonatomic, strong) NSURLSession *session; | ||
|
||
|
||
-(instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration; | ||
|
||
- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request | ||
completionHandler:(void (^)(NSData *data, NSURLResponse *response, NSError *error))completionHandler; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// WTURLSessionManager.m | ||
// WTRequestCenter | ||
// | ||
// Created by SongWentong on 8/31/15. | ||
// Copyright (c) 2015 song. All rights reserved. | ||
// | ||
|
||
#import "WTURLSessionManager.h" | ||
@interface WTURLSessionManager() | ||
|
||
@property (readwrite, nonatomic, strong) NSURLSession *session; | ||
|
||
@end | ||
@implementation WTURLSessionManager | ||
|
||
static NSOperationQueue *sessionCreationQueue = nil; | ||
+(NSOperationQueue*)sessionCreationQueue{ | ||
static dispatch_once_t onceToken; | ||
dispatch_once(&onceToken, ^{ | ||
sessionCreationQueue = [NSOperationQueue new]; | ||
[sessionCreationQueue setSuspended:NO]; | ||
}); | ||
return sessionCreationQueue; | ||
} | ||
|
||
|
||
-(instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration { | ||
self = [super init]; | ||
if (self) { | ||
|
||
} | ||
|
||
if (!configuration) { | ||
configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; | ||
} | ||
self.session = [NSURLSession sessionWithConfiguration:configuration delegate:nil delegateQueue:sessionCreationQueue]; | ||
|
||
|
||
return self; | ||
} | ||
|
||
- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request | ||
completionHandler:(void (^)(NSData *data, NSURLResponse *response, NSError *error))completionHandler | ||
{ | ||
__block NSURLSessionDataTask *dataTask = nil; | ||
// [[WTURLSessionManager sessionCreationQueue] addOperationWithBlock:^{ | ||
dataTask = [self.session dataTaskWithRequest:request completionHandler:completionHandler]; | ||
// }]; | ||
|
||
return dataTask; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
objects = { | ||
|
||
/* Begin PBXBuildFile section */ | ||
27FB3FCC1B93FB1100F5CC7C /* WTURLSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 27FB3FCB1B93FB1100F5CC7C /* WTURLSessionManager.m */; }; | ||
A3B4A7C2199AF60C00A8BAF0 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = A3B4A7C1199AF60C00A8BAF0 /* [email protected] */; }; | ||
A3B4A7C9199AF92000A8BAF0 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A3B4A7C8199AF92000A8BAF0 /* ImageIO.framework */; }; | ||
A3B70F591988BDFA002776F4 /* image.jpg in Resources */ = {isa = PBXBuildFile; fileRef = A3B70F581988BDFA002776F4 /* image.jpg */; }; | ||
|
@@ -66,6 +67,8 @@ | |
/* End PBXContainerItemProxy section */ | ||
|
||
/* Begin PBXFileReference section */ | ||
27FB3FCA1B93FB1100F5CC7C /* WTURLSessionManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WTURLSessionManager.h; path = WTNetWork/WTURLSessionManager.h; sourceTree = SOURCE_ROOT; }; | ||
27FB3FCB1B93FB1100F5CC7C /* WTURLSessionManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WTURLSessionManager.m; path = WTNetWork/WTURLSessionManager.m; sourceTree = SOURCE_ROOT; }; | ||
A3B4A7C1199AF60C00A8BAF0 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.gif; name = "[email protected]"; path = "WTRequestCenter/[email protected]"; sourceTree = "<group>"; }; | ||
A3B4A7C8199AF92000A8BAF0 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; }; | ||
A3B70F581988BDFA002776F4 /* image.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; name = image.jpg; path = WTRequestCenter/image.jpg; sourceTree = "<group>"; }; | ||
|
@@ -320,6 +323,8 @@ | |
E162A4741A6A167300CBC2C5 /* WTURLRequestSerialization.m */, | ||
E1B954C31B60F2E700F206C5 /* WTNetworkReachabilityManager.h */, | ||
E1B954C41B60F2E700F206C5 /* WTNetworkReachabilityManager.m */, | ||
27FB3FCA1B93FB1100F5CC7C /* WTURLSessionManager.h */, | ||
27FB3FCB1B93FB1100F5CC7C /* WTURLSessionManager.m */, | ||
); | ||
name = WTRequestCenter; | ||
path = WTRequestCenter/WTRequestCenter; | ||
|
@@ -440,6 +445,7 @@ | |
E162A49F1A6A168900CBC2C5 /* WTImageViewer.m in Sources */, | ||
E161B2881A8DA37A00A69C09 /* SingleRequestViewController.m in Sources */, | ||
E19F0C2A1A0201460049C1A2 /* RulerView.m in Sources */, | ||
27FB3FCC1B93FB1100F5CC7C /* WTURLSessionManager.m in Sources */, | ||
E181F7761A81138700832D0B /* WTNumberLabel.m in Sources */, | ||
E162A4991A6A168900CBC2C5 /* UIDevice+WTRequestCenter.m in Sources */, | ||
E162A4A01A6A168900CBC2C5 /* WTNetworkActivityIndicatorManager.m in Sources */, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,6 @@ | |
#endif | ||
|
||
#ifdef __OBJC__ | ||
// #import <UIKit/UIKit.h> | ||
// @import UIKit; | ||
// #import <Foundation/Foundation.h> | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters