Skip to content

Instantly share code, notes, and snippets.

@layneios
Last active August 18, 2017 03:46
Show Gist options
  • Save layneios/4f3ff84138328349c57d9b3060561b12 to your computer and use it in GitHub Desktop.
Save layneios/4f3ff84138328349c57d9b3060561b12 to your computer and use it in GitHub Desktop.
OC 获取网络代理设置
+ (void)networkProxySettings {
    CFDictionaryRef proxySettings = CFNetworkCopySystemProxySettings();
    NSDictionary *dictProxy = (__bridge_transfer NSDictionary *)proxySettings;
    if ([dictProxy[@"HTTPEnable"] boolValue]) {
        NSString *address = dictProxy[@"HTTPProxy"];
        NSString *port = dictProxy[@"HTTPPort"];
        NSLog(@"%@ %@", address, port);
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment