title: 好用的iOS調試工具PonyDebugger date: 2019-10-15 23:38:02 thumbnail: blog/ponydebugger.jpeg categories:python
PonyDebugger:github.com/square/Pony…ios
PoneyDebugger是一個很給力的調試工具,它能經過瀏覽器調試App。git
須要電腦上配置服務環境,在iOS項目添加sdk的配置。即可以對App進行網絡請求監控、Core Data數據查看、查看當前界面UI層級等。github
咱們的請求會經過PonyDebugger的代理服務ponyd,能夠直觀的像在瀏覽器上調試網頁請求同樣,調試App的請求。shell
我就直接把官方的圖搬運過來用了
^_^
bootstrap
Core Data瀏覽,只須要經過在應用程序的代碼中啓用就能夠了ponyDebugger?.enableCoreDataDebugging()
swift
PonyDebugger會在瀏覽器中以XML的方式展現應用視圖層次結構,而且能夠在其中看到視圖元素的屬性。在面板中選中一個元素時,對應手機上也會被選中。當刪除一個時也對應刪除,可調整視圖大小。api
PonyDebuggert經過PDLog和PDLogObjects函數遠程記錄日誌查看對象數據瀏覽器
ponyd
,並進去該目錄mkdir ponyd
cd ponyd
複製代碼
ponyd
curl -O -L https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz
curl -O -L https://pypi.python.org/packages/25/5d/cc55d39ac39383dd6e04ae80501b9af3cc455be64740ad68a4e12ec81b00/setuptools-0.6c11-py2.7.egg
curl -O -L https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/pybonjour/pybonjour-1.1.1.tar.gz
tar xvf pybonjour-1.1.1.tar.gz
mv pybonjour-1.1.1 pybonjour
複製代碼
bootstrap-ponyd.py
curl -O -L https://github.com/downloads/square/PonyDebugger/bootstrap-ponyd.py
複製代碼
bootstrap-ponyd.py
添加安裝pybonjour
的命令subprocess.check_call([join(home_dir, 'bin', 'python'), join('pybonjour', 'setup.py'), 'install'])
複製代碼
添加在以下的位置上網絡
def after_install(options, home_dir):
subprocess.check_call([join(home_dir, 'bin', 'python'), join('pybonjour', 'setup.py'), 'install'])
subprocess.check_call([join(home_dir, 'bin', 'pip'),
'install', '-U', '-e', 'git+https://github.com/square/PonyDebugger.git#egg=ponydebugger'])
複製代碼
cat ./bootstrap-ponyd.py | python - --never-download --ponyd-symlink=/usr/local/bin/ponyd ~/Library/PonyDebugger
複製代碼
~/Library/PonyDebugger/bin/easy_install --find-links https://pypi.python.org/simple/singledispatch/ -U singledispatch
~/Library/PonyDebugger/bin/easy_install --find-links https://pypi.python.org/simple/backports-abc/ -U backports_abc
~/Library/PonyDebugger/bin/easy_install --find-links https://pypi.python.org/simple/certifi -U certifi
~/Library/PonyDebugger/bin/easy_install --find-links https://pypi.python.org/simple/six/ -U six
~/Library/PonyDebugger/bin/easy_install --find-links https://pypi.python.org/simple/futures -U futures
sudo ~/Library/PonyDebugger/bin/easy_install -U pybonjour
複製代碼
ponyd update-devtools
複製代碼
ponyd serve --listen-interface=127.0.0.1
複製代碼
下面演示的是經過pod安裝的
pod 'PonyDebugger'
pod install
#import <PonyDebugger/PonyDebugger.h>
let ponyDebugger = PDDebugger.defaultInstance()
ponyDebugger?.enableNetworkTrafficDebugging()
ponyDebugger?.enableViewHierarchyDebugging()
ponyDebugger?.setDisplayedViewAttributeKeyPaths(["frame", "hidden", "alpha"])
ponyDebugger?.forwardAllNetworkTraffic()
ponyDebugger?.enableCoreDataDebugging()
ponyDebugger?.enableRemoteLogging()
ponyDebugger?.connect(to: URL(string: "ws://localhost:9000/device"))
複製代碼
有視頻演示哦!
這裏主要仍是演示了一些怎麼安裝配置的PonyDebugger,由於在這裏遇到些問題因此在此記錄一波。謝謝觀看!