Latest 1.0.0
License MIT
Platforms ios , requires ARC


  • 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.


add "src" files to your project.


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


Pony Cui


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": "",
    "license": "MIT",
    "authors": "PonyCui",
    "platforms": {
        "ios": null
    "source": {
        "git": "",
        "tag": "1.0.0"
    "source_files": [
    "requires_arc": true

Pin It on Pinterest

Share This