[React Native Error]Application XXX has not been registered.

控制台打印如下:

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.

其中ErrorAppDelegate(一般在这个文件)中,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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容