文档教程

一. 已有项目集成weex, 有时候会报错, 因为sdk中用到了socket

pod 'WeexSDK'
pod 'SocketRocket'

 

二. 在app启动方法 -didFinish 中初始化weexSDK

- (void)initWeexSDK{
    //业务配置,非必需
    
    [WXAppConfiguration setAppGroup:@"AliApp"];
    [WXAppConfiguration setAppName:@"集成weex"];
    [WXAppConfiguration setAppVersion:@"1.0.0"];
    
    //初始化SDK环境
    [WXSDKEngine initSDKEnvironment];
    
    //注册自定义module和component,非必需
    /*
     [WXSDKEngine registerComponent:@"MyView" withClass:[MyViewComponent class]];
     [WXSDKEngine registerModule:@"event" withClass:[WXEventModule class]];
     */
    
    //注册component
    [WXSDKEngine registerComponent:@"mycomponent" withClass:[WXComponent class]];
    //注册module
    [WXSDKEngine registerModule:@"callNative" withClass:[JScallNativeModeul class]];
    
    //注册协议的实现类,非必需(需要使用原生的图片加载框架)
//        [WXSDKEngine registerHandler:[WXImgLoaderDefaultImpl new] withProtocol:@protocol(WXImgLoaderProtocol)];
    
    //设置Log输出等级:调试环境默认为Debug,正式发布会自动关闭。
    [WXLog setLogLevel:WXLogLevelAll];
    
    // 开启debug模式
    // [WXDebugTool setDebug:YES];
    
}

 

相关文章:

  • 2021-12-04
  • 2022-12-23
  • 2022-12-23
  • 2021-08-18
  • 2021-05-17
  • 2022-12-23
猜你喜欢
  • 2021-12-10
  • 2021-07-05
  • 2021-06-30
  • 2021-11-17
  • 2022-12-23
  • 2021-09-26
  • 2021-08-31
相关资源
相似解决方案