zoukankan      html  css  js  c++  java
  • IOS调试工具 PonyDebugger

    项目网站:https://github.com/square/PonyDebugger


    使用前需要安装服务端:


    1.需要 Xcode's Command Line Tools

        在终端 输入xcrun检查是否安装

    stsdeMacBook-Pro:~ sts$ xcrun

    Usage: xcrun [options] <tool name> ... arguments ...


    2.安装ponyd

        官方原文是:

    curl -sk https://cloud.github.com/downloads/square/PonyDebugger/bootstrap-ponyd.py |

     python - --ponyd-symlink=/usr/local/bin/ponyd ~/Library/PonyDebugger

        但是并不能用……

        

        解决参考:http://blog.3snews.net/space.php?uid=6188&do=blog&id=69867

        在终端输入1 2 3:

    1 首先下载安装脚本

    curl -O https://cloud.github.com/downloads/square/PonyDebugger/bootstrap-ponyd.py

    2 安装

    python bootstrap-ponyd.py --ponyd-symlink=/usr/local/bin/ponyd ~/Library/PonyDebugger

    3 修复更新,依次执行下面的脚本

    source ~/Library/PonyDebugger/bin/activate

    pip install -U -e git+https://github.com/square/PonyDebugger.git#egg=ponydebugger --allow-external pybonjour --allow-unverified pybonjour

    ponyd update-devtools

    (并不会出现参考网站出现的4那个信息)


        等安装结束,然后输入

    ponyd serve --listen-interface=127.0.0.1

        再在浏览器输入 localhost:9000  验证一下就行了。  

    ( 安装后ponyd在 /Users/sts/Library/PonyDebugger/bin 下)。



    安装客户端:可以使用自动安装或者手动安装。


        A.自动安装

        a.安装CocoaPods

    $ sudo gem install cocoapods

    $ pod setup

        如果在终端中敲入这个命令之后,半天没有任何反应。原因无他,因为那堵墙阻挡了cocoapods.org。

        参考网页:http://code4app.com/article/cocoapods-install-usage 安装cocoapods

        b. 建立 Podfile 文件,并安装依赖库

        在终端中进入(cd命令)你项目所在目录,然后在当前目录下,利用vim创建Podfile,运行:

    $ vim Podfile

        然后在Podfile文件中输入以下文字:

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

        安装依赖库

    $ pod install

        c 添加 ENABLE_PONYDEBUGGER=1

        

        d 在 AppDelegate.m 中添加

    #if ENABLE_PONYDEBUGGER

    #import <PonyDebugger/PonyDebugger.h>

    #endif

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

        // Override point for customization after application launch.

    #if ENABLE_PONYDEBUGGER

        

        PDDebugger *debugger = [PDDebugger defaultInstance];

    //    [debugger autoConnect];

        //开启网络请求监听

        [debugger enableNetworkTrafficDebugging];

        //开启后,可以设置为是否监听所有的网络请求:

        [debugger forwardAllNetworkTraffic];

        

        // 开启Core Data 数据浏览

        [debugger enableCoreDataDebugging];

        //

        [debugger enableViewHierarchyDebugging];

        [debugger setDisplayedViewAttributeKeyPaths:@[@"frame", @"hidden", @"alpha", @"opaque", @"accessibilityLabel", @"text"]];

        //连接服务器哦

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

        [debugger enableRemoteLogging];

    #endif

        return YES;

    }


    然后就可以在浏览器localhost:9090 中查看了。

     
    补充:

        a.在实际项目中可能遇到这样的问题

        

        只需要在building setting中把对应的$(inherited) 加进去就行了。

        

        b.真机调试 需要的改动(将localhost改为局域网中的IP

            1.开启服务器 

    1. ponyd serve --listen-interface=192.168.10.46

            2.连接服务器

    1. [debugger connectToURL:[NSURL URLWithString:@"ws://192.168.10.46:9000/device"]];

        B.手动安装 就不看了。。



    使用:


        使用 NSURLConnection  NSURLSession 需要使用他们的delegate方法, 直接回调的话,在http://localhost:9000/ 中是看不见network的内容的。

     使用UIwebview 看不见network的内容。







  • 相关阅读:
    linux 图形界面形式和命令行形式
    linux 配置 jdk7
    StackOverflowError
    一次失败的svchost hacking
    VB调用API的学习
    植物打僵尸休闲花园外挂代码
    中文日文翻译工具
    vb跨域访问,获得特定的frame进行处理
    HTML对象库简介(Microsoft HTML Object Library > mshtml.tlb)
    用正则分析一段vb代码含有哪些过程或者函数
  • 原文地址:https://www.cnblogs.com/sunyanyan/p/4477638.html
Copyright © 2011-2022 走看看