weexteam / article

This repos is a third party collection, and is not developed nor maintained by Apache Weex.
1.22k stars 141 forks source link

Weex 开发工具 (iOS) #81

Open coderyi opened 8 years ago

coderyi commented 8 years ago

新版中文网站及文档已经上线,请访问 https://weex-project.io/cn/ , 此处后续不再维护,谢谢理解。

iOS开发工具

英文原文

通过Chrome开发者工具远程调试你的原生iOS app

启动weex-devtool:

  1. 安装和运行 weex-devtool

    $:npm install -g weex-devtool
    
    $:weex-devtool  

    它会启动chrome浏览器,展示wss ip 地址在chrome地址栏。

    playground 安装 WXDevtool

  2. 安装依赖.

    $:pod install

    使用

  3. AppDelegate.m 头文件

    #import "WXDevTool.h"
  4. 在App启动的时候初始化 inspector

    注意: The inspector API 必须在weex初始化之前调用

    • (void)setDebug:(BOOL)isDebug;

      isDebug默认是NO,那么你打开的是inspect模式。假如设置isDebug为YES,那么打开debug模式和inspect模式。

      • (void)launchDevToolDebugWithUrl:(NSString *)url;

      wssip 是 展示在 chrome 地址栏的wss 地址.

    • 打开 debug 模式 和 inspector 模式

      eg:- (BOOL)application:(UIApplication )application didFinishLaunchingWithOptions:(NSDictionary )launchOptions { [WXDevTool setDebug:YES]; [WXDevTool launchDevToolDebugWithUrl:@"ws://wssip/debugProxy/native"]; }

    • 打开 inspect 模式, 移除 @selector(setDebug:) 或者 增加 [WXDevTool setDebug:NO]

      eg:- (BOOL)application:(UIApplication )application didFinishLaunchingWithOptions:(NSDictionary )launchOptions { [WXDevTool launchDevToolDebugWithUrl:@"ws://wssip/debugProxy/native"]; }

  5. 编译和运行APP,chrome会显示你的设备,选择inspector。
  6. 支持不同级别的Log打印。

    eg: #import "WXDevTool.h" PDLogE()/PDLogW()

    WXDevtool依赖

你的app必须链接下面的frameworks/dylibs

Security111588 commented 7 years ago

$:pod install

podfile都写什么了??

coderyi commented 7 years ago

参考 weex-devtool-iOS - readme

yundongbot commented 7 years ago

@wang111588 查看 ios/playground/Podfile 目录 https://github.com/alibaba/weex/blob/dev/ios/playground/Podfile

yundongbot commented 7 years ago

新版中文网站及文档已经上线,请访问 https://weex-project.io/cn/ , 此处后续不再维护,谢谢理解。

yhcoding commented 7 years ago

下面的报错是什么原因? Undefined symbols for architecture arm64: "_OBJCCLASS$_WXTracingManager", referenced from: objc-class-ref in TBWXDevTool(WXRenderTracingViewController.o) objc-class-ref in TBWXDevTool(WXApiTracingViewController.o) objc-class-ref in TBWXDevTool(WXTracingViewControllerManager.o) objc-class-ref in TBWXDevTool(WXTracingExceptionImpl.o) "_OBJCCLASS$_WXTracingTask", referenced from: _OBJCCLASS$_WXShowTracingTask in TBWXDevTool(WXRenderTracingViewController.o) "_OBJCMETACLASS$_WXTracingTask", referenced from: _OBJCMETACLASS$_WXShowTracingTask in TBWXDevTool(WXRenderTracingViewController.o) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)