├── README.md └── TestNSURLProtocol ├── TestNSURLProtocol.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── km.xcuserdatad │ │ └── UserInterfaceState.xcuserstate ├── xcuserdata │ └── km.xcuserdatad │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── TestNSURLProtocol.xcscheme └── project.pbxproj └── TestNSURLProtocol ├── TestWebView.h ├── ViewController.h ├── RichURLSessionProtocol.h ├── AppDelegate.h ├── main.m ├── Assets.xcassets └── AppIcon.appiconset │ └── Contents.json ├── Info.plist ├── Base.lproj └── LaunchScreen.storyboard ├── TestWebView.m ├── ViewController.m ├── AppDelegate.m └── RichURLSessionProtocol.m /README.md: -------------------------------------------------------------------------------- 1 | # TestNSURLProtocol 2 | 3 | “使用NSURLProtocol和NSURLSession拦截UIWebView的HTTP请求(包括ajax请求)”文章配套使用的Demo。 4 | 文章地址:http://www.cnblogs.com/wobuyayi/p/6283599.html 5 | -------------------------------------------------------------------------------- /TestNSURLProtocol/TestNSURLProtocol.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TestNSURLProtocol/TestNSURLProtocol.xcodeproj/project.xcworkspace/xcuserdata/km.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidWanderer/TestNSURLProtocol/HEAD/TestNSURLProtocol/TestNSURLProtocol.xcodeproj/project.xcworkspace/xcuserdata/km.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /TestNSURLProtocol/TestNSURLProtocol/TestWebView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestWebView.h 3 | // TestNSURLProtocol 4 | // 5 | // Created by KM on 2017/8/21. 6 | // Copyright © 2017年 KM. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TestWebView : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /TestNSURLProtocol/TestNSURLProtocol/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // TestNSURLProtocol 4 | // 5 | // Created by KM on 2017/8/21. 6 | // Copyright © 2017年 KM. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /TestNSURLProtocol/TestNSURLProtocol/RichURLSessionProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // RichURLSessionProtocol.h 3 | // TestNSURLProtocol 4 | // 5 | // Created by KM on 2017/8/21. 6 | // Copyright © 2017年 KM. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RichURLSessionProtocol : NSURLProtocol 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /TestNSURLProtocol/TestNSURLProtocol/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // TestNSURLProtocol 4 | // 5 | // Created by KM on 2017/8/21. 6 | // Copyright © 2017年 KM. 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 | -------------------------------------------------------------------------------- /TestNSURLProtocol/TestNSURLProtocol/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // TestNSURLProtocol 4 | // 5 | // Created by KM on 2017/8/21. 6 | // Copyright © 2017年 KM. 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 | -------------------------------------------------------------------------------- /TestNSURLProtocol/TestNSURLProtocol.xcodeproj/xcuserdata/km.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | TestNSURLProtocol.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 8B83C2351F4A5C130083DA7C 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /TestNSURLProtocol/TestNSURLProtocol/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /TestNSURLProtocol/TestNSURLProtocol/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | NSAppTransportSecurity 36 | 37 | NSAllowsArbitraryLoads 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /TestNSURLProtocol/TestNSURLProtocol/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 | 27 | 28 | -------------------------------------------------------------------------------- /TestNSURLProtocol/TestNSURLProtocol/TestWebView.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestWebView.m 3 | // TestNSURLProtocol 4 | // 5 | // Created by KM on 2017/8/21. 6 | // Copyright © 2017年 KM. All rights reserved. 7 | // 8 | 9 | #import "TestWebView.h" 10 | #import "RichURLSessionProtocol.h" 11 | 12 | @interface TestWebView () 13 | 14 | @property (nonatomic, strong) UIWebView *webview; 15 | 16 | @end 17 | 18 | @implementation TestWebView 19 | 20 | - (void)loadView{ 21 | 22 | self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 23 | self.view.backgroundColor = [UIColor whiteColor]; 24 | 25 | self.title = @"baidu"; 26 | 27 | CGFloat webW = [[UIScreen mainScreen] bounds].size.width; 28 | CGFloat webH = [[UIScreen mainScreen] bounds].size.height - 64; 29 | 30 | self.webview = [[UIWebView alloc] initWithFrame:CGRectMake(0, 64, webW, webH)]; 31 | [self.view addSubview:self.webview]; 32 | } 33 | 34 | - (void)viewDidLoad { 35 | [super viewDidLoad]; 36 | // Do any additional setup after loading the view. 37 | 38 | self.automaticallyAdjustsScrollViewInsets = NO; 39 | 40 | NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:@"https://www.baidu.com"]]; 41 | [self.webview loadRequest:request]; 42 | 43 | //注册网络请求拦截 44 | [NSURLProtocol registerClass:[RichURLSessionProtocol class]]; 45 | } 46 | 47 | - (void)viewWillDisappear:(BOOL)animated{ 48 | [super viewWillDisappear:animated]; 49 | 50 | //取消注册网络请求拦截 51 | [NSURLProtocol unregisterClass:[RichURLSessionProtocol class]]; 52 | } 53 | 54 | - (void)didReceiveMemoryWarning { 55 | [super didReceiveMemoryWarning]; 56 | // Dispose of any resources that can be recreated. 57 | } 58 | 59 | /* 60 | #pragma mark - Navigation 61 | 62 | // In a storyboard-based application, you will often want to do a little preparation before navigation 63 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 64 | // Get the new view controller using [segue destinationViewController]. 65 | // Pass the selected object to the new view controller. 66 | } 67 | */ 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /TestNSURLProtocol/TestNSURLProtocol/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // TestNSURLProtocol 4 | // 5 | // Created by KM on 2017/8/21. 6 | // Copyright © 2017年 KM. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "TestWebView.h" 11 | 12 | @interface ViewController () 13 | 14 | @property (nonatomic, strong) UITableView *tableView; 15 | 16 | @end 17 | 18 | @implementation ViewController 19 | 20 | - (void)loadView{ 21 | 22 | self.title = @"NSURLProtocol测试"; 23 | 24 | self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 25 | self.view.backgroundColor = [UIColor whiteColor]; 26 | 27 | CGFloat tableW = [[UIScreen mainScreen] bounds].size.width; 28 | CGFloat tableH = [[UIScreen mainScreen] bounds].size.height - 64; 29 | self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 64, tableW, tableH)]; 30 | self.tableView.dataSource = self; 31 | self.tableView.delegate = self; 32 | [self.view addSubview:self.tableView]; 33 | 34 | } 35 | 36 | - (void)viewDidLoad { 37 | [super viewDidLoad]; 38 | // Do any additional setup after loading the view, typically from a nib. 39 | self.automaticallyAdjustsScrollViewInsets = NO; 40 | } 41 | 42 | #pragma mark-TableView的代理方法 43 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ 44 | return 1; 45 | } 46 | 47 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 48 | return 1; 49 | } 50 | 51 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 52 | 53 | static NSString *identifer = @"cell"; 54 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifer]; 55 | 56 | if (!cell) { 57 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifer]; 58 | } 59 | 60 | cell.textLabel.text = @"baidu"; 61 | 62 | return cell; 63 | } 64 | 65 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 66 | 67 | TestWebView *webview = [[TestWebView alloc] init]; 68 | [self.navigationController pushViewController:webview animated:YES]; 69 | 70 | } 71 | 72 | - (void)didReceiveMemoryWarning { 73 | [super didReceiveMemoryWarning]; 74 | // Dispose of any resources that can be recreated. 75 | } 76 | 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /TestNSURLProtocol/TestNSURLProtocol/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // TestNSURLProtocol 4 | // 5 | // Created by KM on 2017/8/21. 6 | // Copyright © 2017年 KM. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ViewController.h" 11 | 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 20 | // Override point for customization after application launch. 21 | 22 | ViewController *vc = [[ViewController alloc] init]; 23 | 24 | UINavigationController *navVC = [[UINavigationController alloc] initWithRootViewController:vc]; 25 | 26 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 27 | 28 | self.window.rootViewController = navVC; 29 | [self.window makeKeyAndVisible]; 30 | 31 | return YES; 32 | } 33 | 34 | 35 | - (void)applicationWillResignActive:(UIApplication *)application { 36 | // 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. 37 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 38 | } 39 | 40 | 41 | - (void)applicationDidEnterBackground:(UIApplication *)application { 42 | // 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. 43 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 44 | } 45 | 46 | 47 | - (void)applicationWillEnterForeground:(UIApplication *)application { 48 | // 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. 49 | } 50 | 51 | 52 | - (void)applicationDidBecomeActive:(UIApplication *)application { 53 | // 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. 54 | } 55 | 56 | 57 | - (void)applicationWillTerminate:(UIApplication *)application { 58 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 59 | } 60 | 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /TestNSURLProtocol/TestNSURLProtocol.xcodeproj/xcuserdata/km.xcuserdatad/xcschemes/TestNSURLProtocol.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /TestNSURLProtocol/TestNSURLProtocol/RichURLSessionProtocol.m: -------------------------------------------------------------------------------- 1 | // 2 | // RichURLSessionProtocol.m 3 | // TestNSURLProtocol 4 | // 5 | // Created by KM on 2017/8/21. 6 | // Copyright © 2017年 KM. All rights reserved. 7 | // 8 | 9 | #import "RichURLSessionProtocol.h" 10 | 11 | static NSString * const RichURLProtocolHandledKey = @"RichURLProtocolHandledKey"; 12 | 13 | @interface RichURLSessionProtocol() 14 | 15 | @property (atomic,strong,readwrite) NSURLSessionDataTask *task; 16 | @property (nonatomic,strong) NSURLSession *session; 17 | 18 | @end 19 | 20 | @implementation RichURLSessionProtocol 21 | 22 | + (BOOL)canInitWithRequest:(NSURLRequest *)request 23 | { 24 | //只处理http和https请求 25 | NSString *scheme = [[request URL] scheme]; 26 | if ( ([scheme caseInsensitiveCompare:@"http"] == NSOrderedSame || 27 | [scheme caseInsensitiveCompare:@"https"] == NSOrderedSame)) 28 | { 29 | // NSLog(@"====>%@",request.URL); 30 | 31 | //看看是否已经处理过了,防止无限循环 32 | if ([NSURLProtocol propertyForKey:RichURLProtocolHandledKey inRequest:request]) { 33 | return NO; 34 | } 35 | 36 | return YES; 37 | } 38 | return NO; 39 | } 40 | 41 | + (NSURLRequest *) canonicalRequestForRequest:(NSURLRequest *)request { 42 | /** 可以在此处添加头等信息 */ 43 | NSMutableURLRequest *mutableReqeust = [request mutableCopy]; 44 | return mutableReqeust; 45 | } 46 | - (void)startLoading 47 | { 48 | NSMutableURLRequest *mutableReqeust = [[self request] mutableCopy]; 49 | //打标签,防止无限循环 50 | [NSURLProtocol setProperty:@YES forKey:RichURLProtocolHandledKey inRequest:mutableReqeust]; 51 | 52 | NSURLSessionConfiguration *configure = [NSURLSessionConfiguration defaultSessionConfiguration]; 53 | 54 | NSOperationQueue *queue = [[NSOperationQueue alloc] init]; 55 | 56 | self.session = [NSURLSession sessionWithConfiguration:configure delegate:self delegateQueue:queue]; 57 | self.task = [self.session dataTaskWithRequest:mutableReqeust]; 58 | [self.task resume]; 59 | } 60 | 61 | - (void)stopLoading 62 | { 63 | [self.session invalidateAndCancel]; 64 | self.session = nil; 65 | } 66 | 67 | - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error 68 | { 69 | if (error != nil) { 70 | [self.client URLProtocol:self didFailWithError:error]; 71 | }else 72 | { 73 | [self.client URLProtocolDidFinishLoading:self]; 74 | } 75 | } 76 | 77 | - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask 78 | didReceiveResponse:(NSURLResponse *)response 79 | completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler 80 | { 81 | [self.client URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed]; 82 | 83 | completionHandler(NSURLSessionResponseAllow); 84 | } 85 | 86 | - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data 87 | { 88 | [self.client URLProtocol:self didLoadData:data]; 89 | } 90 | 91 | - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask willCacheResponse:(NSCachedURLResponse *)proposedResponse completionHandler:(void (^)(NSCachedURLResponse * _Nullable))completionHandler 92 | { 93 | completionHandler(proposedResponse); 94 | } 95 | 96 | //TODO: 重定向 97 | - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task willPerformHTTPRedirection:(NSHTTPURLResponse *)response newRequest:(NSURLRequest *)newRequest completionHandler:(void (^)(NSURLRequest *))completionHandler 98 | { 99 | NSMutableURLRequest* redirectRequest; 100 | redirectRequest = [newRequest mutableCopy]; 101 | [[self class] removePropertyForKey:RichURLProtocolHandledKey inRequest:redirectRequest]; 102 | [[self client] URLProtocol:self wasRedirectedToRequest:redirectRequest redirectResponse:response]; 103 | 104 | [self.task cancel]; 105 | [[self client] URLProtocol:self didFailWithError:[NSError errorWithDomain:NSCocoaErrorDomain code:NSUserCancelledError userInfo:nil]]; 106 | } 107 | 108 | - (instancetype)initWithRequest:(NSURLRequest *)request cachedResponse:(NSCachedURLResponse *)cachedResponse client:(id)client 109 | { 110 | 111 | NSMutableURLRequest* redirectRequest; 112 | redirectRequest = [request mutableCopy]; 113 | 114 | 115 | NSLog(@"拦截的请求:%@",request.URL.absoluteString); 116 | 117 | self = [super initWithRequest:redirectRequest cachedResponse:cachedResponse client:client]; 118 | if (self) { 119 | 120 | // Some stuff 121 | } 122 | return self; 123 | } 124 | 125 | - (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler{ 126 | 127 | // NSLog(@"自定义Protocol开始认证..."); 128 | // NSString *authMethod = [[challenge protectionSpace] authenticationMethod]; 129 | // NSLog(@"%@认证...",authMethod); 130 | // 131 | if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { 132 | NSURLCredential *card = [[NSURLCredential alloc] initWithTrust:challenge.protectionSpace.serverTrust]; 133 | completionHandler(NSURLSessionAuthChallengeUseCredential,card); 134 | } 135 | // 136 | // 137 | // NSLog(@"自定义Protocol认证结束"); 138 | } 139 | 140 | @end 141 | -------------------------------------------------------------------------------- /TestNSURLProtocol/TestNSURLProtocol.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 8B83C23B1F4A5C130083DA7C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B83C23A1F4A5C130083DA7C /* main.m */; }; 11 | 8B83C23E1F4A5C130083DA7C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B83C23D1F4A5C130083DA7C /* AppDelegate.m */; }; 12 | 8B83C2411F4A5C130083DA7C /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B83C2401F4A5C130083DA7C /* ViewController.m */; }; 13 | 8B83C2461F4A5C130083DA7C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8B83C2451F4A5C130083DA7C /* Assets.xcassets */; }; 14 | 8B83C2491F4A5C130083DA7C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8B83C2471F4A5C130083DA7C /* LaunchScreen.storyboard */; }; 15 | 8B83C2521F4A60780083DA7C /* TestWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B83C2511F4A60780083DA7C /* TestWebView.m */; }; 16 | 8B83C2561F4A86F70083DA7C /* RichURLSessionProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B83C2551F4A86F70083DA7C /* RichURLSessionProtocol.m */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 8B83C2361F4A5C130083DA7C /* TestNSURLProtocol.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TestNSURLProtocol.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 8B83C23A1F4A5C130083DA7C /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 22 | 8B83C23C1F4A5C130083DA7C /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 23 | 8B83C23D1F4A5C130083DA7C /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 24 | 8B83C23F1F4A5C130083DA7C /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 25 | 8B83C2401F4A5C130083DA7C /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 26 | 8B83C2451F4A5C130083DA7C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 27 | 8B83C2481F4A5C130083DA7C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 28 | 8B83C24A1F4A5C130083DA7C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 29 | 8B83C2501F4A60780083DA7C /* TestWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestWebView.h; sourceTree = ""; }; 30 | 8B83C2511F4A60780083DA7C /* TestWebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestWebView.m; sourceTree = ""; }; 31 | 8B83C2541F4A86F70083DA7C /* RichURLSessionProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RichURLSessionProtocol.h; sourceTree = ""; }; 32 | 8B83C2551F4A86F70083DA7C /* RichURLSessionProtocol.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RichURLSessionProtocol.m; sourceTree = ""; }; 33 | /* End PBXFileReference section */ 34 | 35 | /* Begin PBXFrameworksBuildPhase section */ 36 | 8B83C2331F4A5C130083DA7C /* Frameworks */ = { 37 | isa = PBXFrameworksBuildPhase; 38 | buildActionMask = 2147483647; 39 | files = ( 40 | ); 41 | runOnlyForDeploymentPostprocessing = 0; 42 | }; 43 | /* End PBXFrameworksBuildPhase section */ 44 | 45 | /* Begin PBXGroup section */ 46 | 8B83C22D1F4A5C130083DA7C = { 47 | isa = PBXGroup; 48 | children = ( 49 | 8B83C2381F4A5C130083DA7C /* TestNSURLProtocol */, 50 | 8B83C2371F4A5C130083DA7C /* Products */, 51 | ); 52 | sourceTree = ""; 53 | }; 54 | 8B83C2371F4A5C130083DA7C /* Products */ = { 55 | isa = PBXGroup; 56 | children = ( 57 | 8B83C2361F4A5C130083DA7C /* TestNSURLProtocol.app */, 58 | ); 59 | name = Products; 60 | sourceTree = ""; 61 | }; 62 | 8B83C2381F4A5C130083DA7C /* TestNSURLProtocol */ = { 63 | isa = PBXGroup; 64 | children = ( 65 | 8B83C2531F4A865B0083DA7C /* Lib */, 66 | 8B83C23C1F4A5C130083DA7C /* AppDelegate.h */, 67 | 8B83C23D1F4A5C130083DA7C /* AppDelegate.m */, 68 | 8B83C23F1F4A5C130083DA7C /* ViewController.h */, 69 | 8B83C2401F4A5C130083DA7C /* ViewController.m */, 70 | 8B83C2501F4A60780083DA7C /* TestWebView.h */, 71 | 8B83C2511F4A60780083DA7C /* TestWebView.m */, 72 | 8B83C2451F4A5C130083DA7C /* Assets.xcassets */, 73 | 8B83C2471F4A5C130083DA7C /* LaunchScreen.storyboard */, 74 | 8B83C24A1F4A5C130083DA7C /* Info.plist */, 75 | 8B83C2391F4A5C130083DA7C /* Supporting Files */, 76 | ); 77 | path = TestNSURLProtocol; 78 | sourceTree = ""; 79 | }; 80 | 8B83C2391F4A5C130083DA7C /* Supporting Files */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | 8B83C23A1F4A5C130083DA7C /* main.m */, 84 | ); 85 | name = "Supporting Files"; 86 | sourceTree = ""; 87 | }; 88 | 8B83C2531F4A865B0083DA7C /* Lib */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | 8B83C2541F4A86F70083DA7C /* RichURLSessionProtocol.h */, 92 | 8B83C2551F4A86F70083DA7C /* RichURLSessionProtocol.m */, 93 | ); 94 | name = Lib; 95 | sourceTree = ""; 96 | }; 97 | /* End PBXGroup section */ 98 | 99 | /* Begin PBXNativeTarget section */ 100 | 8B83C2351F4A5C130083DA7C /* TestNSURLProtocol */ = { 101 | isa = PBXNativeTarget; 102 | buildConfigurationList = 8B83C24D1F4A5C130083DA7C /* Build configuration list for PBXNativeTarget "TestNSURLProtocol" */; 103 | buildPhases = ( 104 | 8B83C2321F4A5C130083DA7C /* Sources */, 105 | 8B83C2331F4A5C130083DA7C /* Frameworks */, 106 | 8B83C2341F4A5C130083DA7C /* Resources */, 107 | ); 108 | buildRules = ( 109 | ); 110 | dependencies = ( 111 | ); 112 | name = TestNSURLProtocol; 113 | productName = TestNSURLProtocol; 114 | productReference = 8B83C2361F4A5C130083DA7C /* TestNSURLProtocol.app */; 115 | productType = "com.apple.product-type.application"; 116 | }; 117 | /* End PBXNativeTarget section */ 118 | 119 | /* Begin PBXProject section */ 120 | 8B83C22E1F4A5C130083DA7C /* Project object */ = { 121 | isa = PBXProject; 122 | attributes = { 123 | LastUpgradeCheck = 0830; 124 | ORGANIZATIONNAME = KM; 125 | TargetAttributes = { 126 | 8B83C2351F4A5C130083DA7C = { 127 | CreatedOnToolsVersion = 8.3.3; 128 | DevelopmentTeam = L8Y35LFT62; 129 | ProvisioningStyle = Automatic; 130 | }; 131 | }; 132 | }; 133 | buildConfigurationList = 8B83C2311F4A5C130083DA7C /* Build configuration list for PBXProject "TestNSURLProtocol" */; 134 | compatibilityVersion = "Xcode 3.2"; 135 | developmentRegion = English; 136 | hasScannedForEncodings = 0; 137 | knownRegions = ( 138 | en, 139 | Base, 140 | ); 141 | mainGroup = 8B83C22D1F4A5C130083DA7C; 142 | productRefGroup = 8B83C2371F4A5C130083DA7C /* Products */; 143 | projectDirPath = ""; 144 | projectRoot = ""; 145 | targets = ( 146 | 8B83C2351F4A5C130083DA7C /* TestNSURLProtocol */, 147 | ); 148 | }; 149 | /* End PBXProject section */ 150 | 151 | /* Begin PBXResourcesBuildPhase section */ 152 | 8B83C2341F4A5C130083DA7C /* Resources */ = { 153 | isa = PBXResourcesBuildPhase; 154 | buildActionMask = 2147483647; 155 | files = ( 156 | 8B83C2491F4A5C130083DA7C /* LaunchScreen.storyboard in Resources */, 157 | 8B83C2461F4A5C130083DA7C /* Assets.xcassets in Resources */, 158 | ); 159 | runOnlyForDeploymentPostprocessing = 0; 160 | }; 161 | /* End PBXResourcesBuildPhase section */ 162 | 163 | /* Begin PBXSourcesBuildPhase section */ 164 | 8B83C2321F4A5C130083DA7C /* Sources */ = { 165 | isa = PBXSourcesBuildPhase; 166 | buildActionMask = 2147483647; 167 | files = ( 168 | 8B83C2411F4A5C130083DA7C /* ViewController.m in Sources */, 169 | 8B83C2521F4A60780083DA7C /* TestWebView.m in Sources */, 170 | 8B83C23E1F4A5C130083DA7C /* AppDelegate.m in Sources */, 171 | 8B83C23B1F4A5C130083DA7C /* main.m in Sources */, 172 | 8B83C2561F4A86F70083DA7C /* RichURLSessionProtocol.m in Sources */, 173 | ); 174 | runOnlyForDeploymentPostprocessing = 0; 175 | }; 176 | /* End PBXSourcesBuildPhase section */ 177 | 178 | /* Begin PBXVariantGroup section */ 179 | 8B83C2471F4A5C130083DA7C /* LaunchScreen.storyboard */ = { 180 | isa = PBXVariantGroup; 181 | children = ( 182 | 8B83C2481F4A5C130083DA7C /* Base */, 183 | ); 184 | name = LaunchScreen.storyboard; 185 | sourceTree = ""; 186 | }; 187 | /* End PBXVariantGroup section */ 188 | 189 | /* Begin XCBuildConfiguration section */ 190 | 8B83C24B1F4A5C130083DA7C /* Debug */ = { 191 | isa = XCBuildConfiguration; 192 | buildSettings = { 193 | ALWAYS_SEARCH_USER_PATHS = NO; 194 | CLANG_ANALYZER_NONNULL = YES; 195 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 196 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 197 | CLANG_CXX_LIBRARY = "libc++"; 198 | CLANG_ENABLE_MODULES = YES; 199 | CLANG_ENABLE_OBJC_ARC = YES; 200 | CLANG_WARN_BOOL_CONVERSION = YES; 201 | CLANG_WARN_CONSTANT_CONVERSION = YES; 202 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 203 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 204 | CLANG_WARN_EMPTY_BODY = YES; 205 | CLANG_WARN_ENUM_CONVERSION = YES; 206 | CLANG_WARN_INFINITE_RECURSION = YES; 207 | CLANG_WARN_INT_CONVERSION = YES; 208 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 209 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 210 | CLANG_WARN_UNREACHABLE_CODE = YES; 211 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 212 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 213 | COPY_PHASE_STRIP = NO; 214 | DEBUG_INFORMATION_FORMAT = dwarf; 215 | ENABLE_STRICT_OBJC_MSGSEND = YES; 216 | ENABLE_TESTABILITY = YES; 217 | GCC_C_LANGUAGE_STANDARD = gnu99; 218 | GCC_DYNAMIC_NO_PIC = NO; 219 | GCC_NO_COMMON_BLOCKS = YES; 220 | GCC_OPTIMIZATION_LEVEL = 0; 221 | GCC_PREPROCESSOR_DEFINITIONS = ( 222 | "DEBUG=1", 223 | "$(inherited)", 224 | ); 225 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 226 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 227 | GCC_WARN_UNDECLARED_SELECTOR = YES; 228 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 229 | GCC_WARN_UNUSED_FUNCTION = YES; 230 | GCC_WARN_UNUSED_VARIABLE = YES; 231 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 232 | MTL_ENABLE_DEBUG_INFO = YES; 233 | ONLY_ACTIVE_ARCH = YES; 234 | SDKROOT = iphoneos; 235 | }; 236 | name = Debug; 237 | }; 238 | 8B83C24C1F4A5C130083DA7C /* Release */ = { 239 | isa = XCBuildConfiguration; 240 | buildSettings = { 241 | ALWAYS_SEARCH_USER_PATHS = NO; 242 | CLANG_ANALYZER_NONNULL = YES; 243 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 244 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 245 | CLANG_CXX_LIBRARY = "libc++"; 246 | CLANG_ENABLE_MODULES = YES; 247 | CLANG_ENABLE_OBJC_ARC = YES; 248 | CLANG_WARN_BOOL_CONVERSION = YES; 249 | CLANG_WARN_CONSTANT_CONVERSION = YES; 250 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 251 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 252 | CLANG_WARN_EMPTY_BODY = YES; 253 | CLANG_WARN_ENUM_CONVERSION = YES; 254 | CLANG_WARN_INFINITE_RECURSION = YES; 255 | CLANG_WARN_INT_CONVERSION = YES; 256 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 257 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 258 | CLANG_WARN_UNREACHABLE_CODE = YES; 259 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 260 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 261 | COPY_PHASE_STRIP = NO; 262 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 263 | ENABLE_NS_ASSERTIONS = NO; 264 | ENABLE_STRICT_OBJC_MSGSEND = YES; 265 | GCC_C_LANGUAGE_STANDARD = gnu99; 266 | GCC_NO_COMMON_BLOCKS = YES; 267 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 268 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 269 | GCC_WARN_UNDECLARED_SELECTOR = YES; 270 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 271 | GCC_WARN_UNUSED_FUNCTION = YES; 272 | GCC_WARN_UNUSED_VARIABLE = YES; 273 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 274 | MTL_ENABLE_DEBUG_INFO = NO; 275 | SDKROOT = iphoneos; 276 | VALIDATE_PRODUCT = YES; 277 | }; 278 | name = Release; 279 | }; 280 | 8B83C24E1F4A5C130083DA7C /* Debug */ = { 281 | isa = XCBuildConfiguration; 282 | buildSettings = { 283 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 284 | DEVELOPMENT_TEAM = L8Y35LFT62; 285 | INFOPLIST_FILE = TestNSURLProtocol/Info.plist; 286 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 287 | PRODUCT_BUNDLE_IDENTIFIER = com.rich.KM.TestNSURLProtocol; 288 | PRODUCT_NAME = "$(TARGET_NAME)"; 289 | }; 290 | name = Debug; 291 | }; 292 | 8B83C24F1F4A5C130083DA7C /* Release */ = { 293 | isa = XCBuildConfiguration; 294 | buildSettings = { 295 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 296 | DEVELOPMENT_TEAM = L8Y35LFT62; 297 | INFOPLIST_FILE = TestNSURLProtocol/Info.plist; 298 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 299 | PRODUCT_BUNDLE_IDENTIFIER = com.rich.KM.TestNSURLProtocol; 300 | PRODUCT_NAME = "$(TARGET_NAME)"; 301 | }; 302 | name = Release; 303 | }; 304 | /* End XCBuildConfiguration section */ 305 | 306 | /* Begin XCConfigurationList section */ 307 | 8B83C2311F4A5C130083DA7C /* Build configuration list for PBXProject "TestNSURLProtocol" */ = { 308 | isa = XCConfigurationList; 309 | buildConfigurations = ( 310 | 8B83C24B1F4A5C130083DA7C /* Debug */, 311 | 8B83C24C1F4A5C130083DA7C /* Release */, 312 | ); 313 | defaultConfigurationIsVisible = 0; 314 | defaultConfigurationName = Release; 315 | }; 316 | 8B83C24D1F4A5C130083DA7C /* Build configuration list for PBXNativeTarget "TestNSURLProtocol" */ = { 317 | isa = XCConfigurationList; 318 | buildConfigurations = ( 319 | 8B83C24E1F4A5C130083DA7C /* Debug */, 320 | 8B83C24F1F4A5C130083DA7C /* Release */, 321 | ); 322 | defaultConfigurationIsVisible = 0; 323 | }; 324 | /* End XCConfigurationList section */ 325 | }; 326 | rootObject = 8B83C22E1F4A5C130083DA7C /* Project object */; 327 | } 328 | --------------------------------------------------------------------------------