Latest 1.0.0
Homepage https://github.com/PonyCui/NSEtcHosts
License MIT
Platforms ios , requires ARC

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.

Latest podspec

{
    "name": "NSEtcHosts",
    "version": "1.0.0",
    "summary": "/etc/hosts with NSURLRequest All networking library are compatible.",
    "description": "                   /etc/hosts with NSURLRequest All networking library are compatible. u5e94u7528u5185u5b9eu73b0u57dfu540dHostu7ed1u5b9auff0cu5f00u53d1u5229u5668u3002n",
    "homepage": "https://github.com/PonyCui/NSEtcHosts",
    "license": "MIT",
    "authors": "PonyCui",
    "platforms": {
        "ios": null
    },
    "source": {
        "git": "https://github.com/PonyCui/NSEtcHosts.git",
        "tag": "1.0.0"
    },
    "source_files": [
        "Src",
        "Src/*.{h,m}"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This