您的位置:首页 > 其它

ponyDebugger安装失败处理和使用感悟

2014-04-23 10:45 309 查看
ponyDebugger是一个远程调试工具包,通过使用 Chrome 开发者工具来调试 iOS 应用的网络流量和数据存储。https://github.com/square/PonyDebugger这有它的源码和使用方法。

下面我简单说明一下分别在模拟器和真机下配置使用ponyDebugger

一.在模拟器下使用ponyDebugger

1.配置服务器端

1). 安装 Xcode's Command Line Tools
2). 在shell里面执行下面命令

12[/code]
curl -sk https://cloud.github.com/downloads/square/PonyDebugger/bootstrap-ponyd.py | \  python - --ponyd-symlink=/usr/local/bin/ponyd ~/Library/PonyDebugger[/code]
如果安装过程中处理如下问题:

12[/code]
curl -sk https://cloud.github.com/downloads/square/PonyDebugger/bootstrap-ponyd.py | \  python - --ponyd-symlink=/usr/local/bin/ponyd ~/Library/PonyDebuggerNew python executable in /Users/wenchuang/Library/PonyDebugger/bin/python
Installing setuptools................done.
Installing pip..............done.
Obtaining ponydebugger from git+https://github.com/square/PonyDebugger.git#egg=ponydebugger
Updating ./Library/PonyDebugger/src/ponydebugger clone
Running setup.py (path:/Users/wenchuang/Library/PonyDebugger/src/ponydebugger/setup.py) egg_info for package ponydebugger

Installing extra requirements: 'egg'
Downloading/unpacking tornado (from ponydebugger)
Downloading tornado-3.2.tar.gz (400kB): 400kB downloaded
Running setup.py (path:/Users/wenchuang/Library/PonyDebugger/build/tornado/setup.py) egg_info for package tornado

Downloading/unpacking pybonjour (from ponydebugger)
Could not find any downloads that satisfy the requirement pybonjour (from ponydebugger)
Some externally hosted files were ignored (use --allow-external pybonjour to allow).
Cleaning up...
No distributions at all found for pybonjour (from ponydebugger)
Storing debug log for failure in /Users/wenchuang/.pip/pip.log
Traceback (most recent call last):
File "<stdin>", line 2462, in <module>
File "<stdin>", line 946, in main
File "<stdin>", line 1794, in after_install
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 511, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/Users/wenchuang/Library/PonyDebugger/bin/pip', 'install', '-U', '-e', 'git+https://github.com/square/PonyDebugger.git#egg=ponydebugger']' returned non-zero exit status 1
[/code]
解决办法:


[/code]
 在shell里面执行下面命令
# activate your virtualenv
source ~/Library/PonyDebugger/bin/activate
# update the ponyd source
pip install -U -e git+https://github.com/square/PonyDebugger.git#egg=ponydebugger --allow-external pybonjour --allow-unverified pybonjour
# updates chrome dev tools source
ponyd update-devtools

3). 安装成功以后,在shell里面执行

1[/code]
ponyd serve --listen-interface=127.0.0.1

注意:这时候如果弹出-bash: ponyd: command not found,修改成:~/Library/PonyDebugger/bin/ponyd serve --listen-interface=127.0.0.1 就ok了
[/code]
4). 打开你的浏览器 输入地址

http://localhost:9000

如果看见的是这样

test1说明服务器端已经安装好了。

2.IOS 端

(1)安装cocoapoads
$ sudo gem install cocoapods
$ pod setup

(2)cd到文件目录,编辑Profile文件


$ cd 文件目录
$ vim Profile

(3)点击i进行编辑,退出编辑(点击esc键,插入:wq)

platform :ios, '5.0'
pod 'PonyDebugger', '~> 0.3.1'

(4)安装

$ pod install


3.使用

在你的工程中,输入下面的代码:

PDDebugger *debugger = [PDDebugger defaultInstance];

[debugger enableNetworkTrafficDebugging];

[debugger forwardAllNetworkTraffic];

[debugger enableCoreDataDebugging];

[debugger connectToURL:[NSURL URLWithString:@"ws://127.0.0.1/device"]];

4.然后编译工程,运行,在浏览器中就可以浏览到信息了。

二:在真机下使用ponyDebugger工具

在真机下运行ponyDebugger这个工具,其它的地方都相似,唯一不同的地方有3:

(1)要确保手机和pc在统一网络下(手机和pc要连接到统一无线网络中)

(2)确认你的ip地址

直接在concle模式下,输入 ifconfig,查找出你的ip地址(我的是en1下inet ,为什么我也不懂,我是试出来的结果,那位高人知道给我解释下行吗?)

(3).将所有地址修改为2中的ip地址,主要设计到3个地方,

一是~/Library/PonyDebugger/bin/ponyd serve --listen-interface=你的ip

二是浏览器地址栏中:://你的ip:9000

三是代码中:[debugger connectToURL:[NSURL URLWithString:@"ws://你的ip/device"]];
这样ponyDebugger在真机或是模拟器中都搭建起来了,要想多了解,多看看源码。。。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: