控制台打印如下:
Unhandled JS Exception: Application moduleName has not been registered.
This is either due to a require() error during initialization or
failure to call AppRegistry.registerComponent.
其中Error
为AppDelegate
(一般在这个文件)中,RCTRootView
初始化函数里moduleName
的参数值。
// AppDelegate.m
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"moduleName"
initialProperties:nil
launchOptions:launchOptions];
// AppDelegate.swift
let moduleName:String = "moduleName"
let rootView: RCTRootView = RCTRootView(bundleURL: jsCodeLocation, moduleName: moduleName, initialProperties: nil, launchOptions: launchOptions)
再查看你的index.ios.js文件中AppKey
是否与RCTRootView
初始化函数的moduleName
的参数值一致,不一致将报错。
AppRegistry.registerComponent('AppKey', () => BaseApp);
AppRegistry_Error.png
网友评论