[react-native] 导入原有的iOS项目报 Application XXX has not been registered错误

来源:互联网 发布:php cookie 跨域 编辑:程序博客网 时间:2024/05/20 11:33

NSURL *jsCodeLocation= [[RCTBundleURLProvider sharedSettingsjsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];

采用上面的URL方式,报 Application XXX has not been registered错误

可能有两个原因

一、

AppRegistry.registerComponent('项目名',()=>xxx)跟

RCTRootView *rootView = [[RCTRootViewalloc]initWithBundleURL:jsCodeLocation

                                                       moduleName:项目名

                                                initialProperties:nil

                                                    launchOptions:launchOptions];

的项目名不一致;

二、还有可能是main.jsbundle 文件的缺失,或是不对。需要重新生成该文件。

生成方法:进入到项目根目录(含node_modules文件),先要npm start ,然后再执行

curl http://localhost:8081/index.ios.bundle -o main.jsbundle命令


0 0