I am a mobile application tester. To test the application, I often build it using Xcode, with the phone connected via a USB cable. I use Charles to examine the responses the application returns in the form of JSON files, so I can view API responses. However, to achieve this, I have to manually configure the iPhone’s proxy settings by adding a proxy hostname and proxy port. Then, I have to disable it. As I repeat this process several times a day, it is becoming time-consuming and kinda dumb to do. Therefore, I have been thinking of a way to automate this process.
So I tried to create a script, to mimic the process of using ADB on Android side, but it seems that this script only works on my mac, it does not impact proxy on the connected iPhone.
#!/bin/bash
proxy_host="<proxy_host>"
proxy_port="<proxy_port>"
sudo networksetup -setwebproxy Wi-Fi $proxy_host $proxy_port
sudo networksetup -setsecurewebproxy Wi-Fi $proxy_host $proxy_port
echo "Proxy set: $proxy_host:$proxy_port"
Can you provide any guidance/ideas of what I can do to automate this, so that I don’t have to manually input the proxy hostname and proxy port each time?