HTTP Traffic monitoring issue when using MonoTouch, HttpClient and Charles Proxy

筅森魡賤 提交于 2019-11-29 07:01:50

There's many ways to initialize HttpClient. Some ways won't talk with the OS (fully managed) and won't be aware of the iOS proxy settings.

The best (for iOS) is generally to use the handler that uses CFNetwork, see this blog for more details. Basically it means:

var client = new HttpClient (CFNetworkHandler ());

Otherwise you'll need to set the HttpClientHandler.Proxy to CFNetwork.GetDefaultProxy. E.g.

var handler = new HttpClientHandler {
    Proxy = CFNetwork.GetDefaultProxy (),
    UseProxy = true,
};
var client = new HttpClient(handler);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!