How to use a Proxy Server with Alamofire 4 and Swift 3 : <p><em>Please don't mark as duplicate, I haven't been able to solve my Issue with the existing threads.</em></p>

<p>I'm trying to use my Proxy for an API request that needs a specified IP.
To debug my issue, I'm requesting the IP from a webservice.</p>

<p>This is my current code:</p>

<pre><code>import UIKit
import Alamofire

class ViewController: UIViewController {

    var requestManager = Alamofire.SessionManager.default

    override func viewDidLoad() {
        super.viewDidLoad()
    }

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(true)

        var proxyConfiguration = [NSObject: AnyObject]()
        proxyConfiguration[kCFNetworkProxiesHTTPProxy] = "http://xxx@eu-west-static-01.quotaguard.com" as AnyObject?
        proxyConfiguration[kCFNetworkProxiesHTTPPort] = "9293" as AnyObject?
        proxyConfiguration[kCFNetworkProxiesHTTPEnable] = 1 as AnyObject?

        let cfg = Alamofire.SessionManager.default.session.configuration
        cfg.connectionProxyDictionary = proxyConfiguration

        let ip = URL(string: "https://api.ipify.org?format=json")

        requestManager = Alamofire.SessionManager(configuration: cfg)
        requestManager.request(ip!).response { response in
            print("Request: \(response.request)")
            print("Response: \(response.response)")
            print("Error: \(response.error)")

            if let data = response.data, let utf8Text = String(data: data, encoding: .utf8) {
                print("Data: \(utf8Text)")
            }
        }
    }
}
</code></pre>

<p>The problem: the responsed IP is the same with or without the <code>proxyConfiguration</code>. Any help is very appreciated.</p>

<p>PS: physical device used.</p>
