How to Debug iOS Traffic on an iPhone Device
I’m responsible for production support for an iOS mobile app, and one of the challenges is debugging HTTPS traffic between the iPhone and our server.
In this article, I’ll explain how to capture requests, responses, and HTTP headers.
Step 1:
Download and install Charles on your laptop from https://www.charlesproxy.com/download/. After installation, click on “Install Charles Root Certificate on a Mobile Device or Remote Browser.”
A popup with details will appear.
Step 2:
Connect your iPhone to the same Wi-Fi network as your laptop. In the iPhone’s Wi-Fi settings, navigate to HTTP proxy and choose “Configure Proxy” with manual details.
Enter the Server and Port number that are displayed in the popup on your laptop. The popup should update to confirm the connection.
Next, open Safari on your iPhone and navigate to chls.pro/ssl. Download and install the certificate by clicking “Allow.”
Click “Install” for the Profile.
At this point, you’re done with this step.
Step 3:
On your iPhone, go to Settings > General > About > Certificate Trust Settings and toggle “Charles Proxy CA” to “On.”
Final Step:
Restart Charles on your laptop. You should now be able to see traffic, including HTTPS content. For example, traffic from the Medium app on iOS can be captured as shown below:
If you encounter any issues, feel free to reach out. Happy debugging! :)