Skip to content

/etc/hosts with NSURLRequest All networking library are compatible. 应用内实现域名Host绑定,开发利器。

License

Notifications You must be signed in to change notification settings

PonyCui/PPEtcHosts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

/etc/hosts with NSURLRequest All networking library are compatible. 应用内实现域名Host绑定,开发利器。

Resources

License

Stars

Watchers

Forks

Packages

No packages published