7

I have installed Charles proxy, then installed the root certificate and root certificate for iOS simulator. Then I ran the application of the simulator but I cannot see any request inside charles.

When I curl the same request with proxy it shows up in the Charles

curl --proxy 127.0.0.1:8888 -k -v https://example.com
hariszaman
  • 8,202
  • 2
  • 40
  • 59

3 Answers3

6

There is no need to use curl.

Xcode simulators use the host OS's network settings so when you change anything in the (macOS) System Preferences or in the Charles Proxy app, you have to restart the simulator.

You should complete the following settings:

  1. Enable this option in the Charles app: Proxy > macOS Proxy (It will set your localhost as a proxy on the (macOS) System Preferences > Network > Advanced > Proxies tab)

  2. On iOS 10.3 or later, navigate to Settings > General > About > Certificate Trust Settings on your phone/simulator and enable full trust for the Charles Proxy certificate.

  3. Restart the Xcode Simulator

kubano
  • 633
  • 7
  • 10
0

New16 may be on to something -

Not sure which simulator you use, but I assume that it uses your Mac's internet connection, unlike real devices that connect to Charlesproxy through the http port that you specify (8888 by default).

While http traffic proxied through that port will always be recorded by Charles, recording the traffic of desktop apps like your simulator is optional. Thus the simulator's traffic will only be recorded if you check the corresponding option in the "Proxy" menu. (In Charles on Windows, the available options are "Windows Proxy" and "Firefox Proxy", not sure what are the options on a Mac.)

aaadddmmm
  • 66
  • 5
0

While you have done the other steps for macOS Proxy and Certificate Trust Settings etc, one important thing to validate is adding ATS flag to your debug build:

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
</dict>

You must remember to re-enable ATS before you release your app to take advantage of the security that ATS provides.

Best place to troubleshoot any Charles configuration issue: https://www.charlesproxy.com/documentation/faqs/