ios - 由于错误而无法加载模块并且未调用 `AppRegistry.registerComponent`。[ios,xcode]

标签 ios xcode react-native

我在 react native 中有 android 和 ios 应用程序,它们都使用 webview 将网页显示为应用程序。
由于我必须更改包名称才能将其部署在 google play 上,因为第一个包名称已被占用。我更改了 app.json 文件和 android 文件夹中的所有名称,没关系。
现在我的问题是我需要在我的 ios 文件夹中更改什么,以便我的应用程序在 xcode 中工作。我有这个错误。

Invariant Violation: "RestApp" has not been registered. This can happen if:

  • Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
  • A module failed to load due to an error and AppRegistry.registerComponent wasn't called.

这是我的 app.json 文件
{
  "name": "restapphhopp",
  "displayName": "RestApphhopp"
}
索引.js 文件
/**
 * @format
 */

import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';

AppRegistry.registerComponent(appName, () => App);

最佳答案

这里的问题是 姓名 您正在为您的应用使用

Invariant Violation: "RestApp" has not been registered. This can happen if:

    Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
    A module failed to load due to an error and AppRegistry.registerComponent wasn't called.
您的索引文件正在使用 应用名称 来自 app.json 姓名 注册您的组件的字段,在您的情况下是 “名称”:“restapphhopp”
更改您的模块名称 在 ios AppDelegate.m 文件中到 重新下载
moduleName:@"restapphhopp"

关于ios - 由于错误而无法加载模块并且未调用 `AppRegistry.registerComponent`。[ios,xcode],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64167281/

相关文章:

xcode - 无法打开 Storyboard(com.apple.InterfaceBuilder 错误 -1。)

objective-c - 单击按钮时如何传递对象

react-native - React Native 响应式图像宽度,而图像的宽高比保持不变

javascript - axios 获取请求返回请求失败,错误 400

ios - 增加 Swift 4 中启动画面的时间

ios - 我在 pod install Kanna 时遇到错误

ios - SCXML解析IOS

iOS:如何在她/他进入地铁之前获取最后一个用户的位置?

ios - Xcode 错误 "Could not find Developer Disk Image"

javascript - 在 React Native 中,在 React Navigation v3 中单击 bottomTabNavigator 上的选项卡时,如何刷新我的组件?