码迷,mamicode.com
首页 > 移动开发 > 详细

在iOS端如何使用Charles用作http调试

时间:2015-05-02 15:06:23      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:

转:http://blog.csdn.net/messageloop3/article/details/9966727

在iOS端如何使用Charles用作http调试

 

After noticing that the caching in iPad Safari seemed a little funky, I made an effort to decipher some of the logic used by the browser cache. I didn’t get very far, but in the process I figured out how to route my iPad HTTP traffic through a web debugger on my laptop. It turns out it was very easy to do (although I’m sure there is a more complicated way to go about it).

What follows is a simple step-by-step for connecting your iPad to an HTTP debugging proxy. The main requirement is that your desktop/laptop and iPad be on the same wireless network. Then it’s just a matter of telling your iPad to use your desktop as an HTTP proxy.

I’m going to walk through how to do this on a Mac with the highly recommended HTTP proxy appCharles, but the same basic steps should also work for a Windows HTTP debugger such as Fiddler. (Update: Fiddler users, see Eric Lawrence’s comment below.) Additionally, the steps are the same for connecting your iPhone or iPod Touch.

1. Get your system IP address for your desktop

The easiest way to do this on a Mac is to Spotlight your way to the “Network Utility” app. Make sure you’re on your Wi-Fi network and take note of the IP address. This is your desktop’s local IP.

技术分享

2. Tell your iPad about your desktop IP

On your iPad, go to Settings > Wi-Fi and click the arrow next your Wi-Fi connection. Under “HTTP Proxy”, select the Manual button and enter your desktop’s IP address in the Server field. Then enter “8888″ in the Port field. Close out.

技术分享

3. Configure Charles

Open Charles and select Proxy > Proxy Settings. Under the Proxies tab, make sure the HTTP proxy value is set to 8888. Then click the “Mac OS X” tab and check “Enable Mac OS X Proxy” and “Use HTTP Proxy”. Click OK.

技术分享

4. Start capturing HTTP traffic

Click the Record button in Charles and then load a web page in iPad Safari. You should see the following alert asking you if you want to allow your iPad to connect to Charles. Select “Allow”.

技术分享

Now all of your HTTP traffic in iPad Safari should be recorded by Charles.

When you’re finished doing all of your fun HTTP debugging, don’t forget to turn off the HTTP proxy in the Wi-Fi settings of your iPad.

在iOS端如何使用Charles用作http调试

标签:

原文地址:http://www.cnblogs.com/ygm900/p/4471890.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!