[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);
[React Native Error]Application XXX has not been registered._第1张图片
AppRegistry_Error.png

你可能感兴趣的:([React Native Error]Application XXX has not been registered.)