Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Check if iOS app is connected to proxy
func isConnectedToProxy() -> Bool {
let host = ""
if let url = URL(string: host),
let proxySettingsUnmanaged = CFNetworkCopySystemProxySettings() {
let proxySettings = proxySettingsUnmanaged.takeRetainedValue()
let proxyUnmanaged = CFNetworkCopyProxiesForURL(url as CFURL, proxySettings)
if let proxies = proxyUnmanaged.takeRetainedValue() as? [[String : AnyObject]], proxies.count > 0 {
let proxy = proxies[0]
let key = kCFProxyTypeKey as String
let value = kCFProxyTypeNone as String
if let v = proxy[key] as? String, v != value {
return true
return false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.