Getting the Charles Debugging Proxy to Work with iOS
The Charles Web Debugging Proxy is a near mandatory tool for any developer. Getting it to work with your desktop apps is usually very easy since it just…works. However, for use with mobile, there are a couple tricks.
Configuring for the iOS Simulator
The iOS Simulator is a native app that “imitates” your iTouch device. Because of that, the only configuration you need is to install the Charles certificate. You can do that by downloading the cert and just dragging it on to your iOS Simulator. Alternatively, navigate to the URL https://chls.pro/ssl using Safari on the Simulator.
Lately, there’s a second step to enable Charles for the first time and that is you have to enabled the certificate. To do that, on your devices Settings, navigate to General -> About -> Certificate Trust Settings and make sure “Charles Proxy Custom…” is switched on!
Additionally, in some cases, SSL security prevents the use of Charles. One thing you might try (and use this only for development purposes!) is to set your NSAppTransportSecurity/NSAllowsArbitraryLoads option to true in your Info.plist.
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Configuring for an iOS Device
Setup is similar for a device except that the only way to install the certificate is to navigate to the URL https://chls.pro/ssl using Safari on the Simulator and enabling that certificate as described above.
Lastly, since you want to use the Charles Proxy which is on a device other than your iPhone (presumably your laptop), you need to set your Wifi to point at your proxy. In Settings, go to Wi-Fi and select your Wi-Fi network. Scroll down to “HTTP Proxy” and change it to “Manual.” For the server, set it to the IP of your computer and set the port to 8888.
Be sure to turn your Proxy off when you’re done!
Comments are currently closed.