Weex 初始化 Weex
2023-12-27 15:58 更新
建议在 didFinishLaunchingWithOptions
回调中初始化 Weex,你也可以在子线程中异步初始化,但需要确保渲染 Weex 页面前初始化已经全部完成。
// App configuration
[WXAppConfiguration setAppGroup:@"Your app group"];
[WXAppConfiguration setAppName:@"Your app name"];
[WXAppConfiguration setAppVersion:@"Your app version"];
//Initialize WeexSDK
[WXSDKEngine initSDKEnvironment];
//Register custom modules and components, optional.
[WXSDKEngine registerComponent:@"myview" withClass:[MyViewComponent class]];
[WXSDKEngine registerModule:@"mymodule" withClass:[MyWeexModule class]];
//Register the implementation of protocol, optional.
[WXSDKEngine registerHandler:[WXAppNavigationImpl new] withProtocol:@protocol(WXNavigationProtocol)];
//Set the log level, optional
[WXLog setLogLevel: WXLogLevelWarning];
以上内容是否对您有帮助:
更多建议: