weex 初始化

文档教程

一. 已有项目集成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];
    
}
原文地址:https://www.cnblogs.com/daxueshan/p/9868824.html