Skip to content

Latest commit

 

History

History
49 lines (32 loc) · 1.5 KB

README.md

File metadata and controls

49 lines (32 loc) · 1.5 KB

PPEtcHosts

  • To avoid any confusion, this project has been rename as 'PPEtcHosts', thanks Mattt.

This PPEtcHosts use another implementation way, thanks for Mattt Thompson.

This PPEtcHosts gives you the whole application host name controls. It effects UIWebView/NSURLConnection/NSURLSession etc.

Because all this library depends NSURLRequest.

One More Thing! AFNetworking, SDWebImage is also available.

PonyCui/PPEtcHosts uses NSURLRequest, swizzling init method.

This is a proof-of-concept, and is not intended for use in production. It's not safe use in prodution. For safely, all code use DEBUG marcos to prevent NSEtcHosts Class build in prodution.

Install

add "src" files to your project.

Usage

#import "NSEtcHosts.h"
#ifdef DEBUG
    [NSEtcHosts addHost:@"www.github.com" ipAddress:@"210.38.111.228"];
#endif
NSURL *URL = [NSURL URLWithString:@"http://www.github.com"];
[webView loadRequest:[NSURLRequest requestWithURL:URL]];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.github.com"]];
[NSURLConnection sendAsynchronousRequest:request
                                   queue:[NSOperationQueue mainQueue]
                                   completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
}];

Contact

Pony Cui

License

PPEtcHosts is available under the MIT license. See the LICENSE file for more info.