如何在React Native项目中重新生成ios文件夹? [英] How can I regenerate ios folder in React Native project?

查看:251
本文介绍了如何在React Native项目中重新生成ios文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

前一段时间我在我的本机应用程序中删除了/ ios目录(让我们称之为X)。我一直在使用android模拟器开发和测试,但现在我想确保它适用于带有xcode模拟器等的ios。

So a while ago I deleted the /ios directory in my react native app (let's call it X). I've been developing and testing using the android emulator but now I'd like to make sure it works on ios with xcode simulator etc.

所以我目前的想法是用ios文件夹创建一个新的反应原生裸项目(让我们称之为Y),然后按照这些步骤重命名Y,使其名称为X,然后将/ ios目录从Y移动到X并尝试 run-ios

So my current idea is to create a new react native bare project (let's call it Y) with ios folder, then follow these steps to rename Y so that it has the name of X and then moving the /ios directory from Y into X and trying to run-ios.

我会在这里更新这是怎么回事,但我想知道是否有更好的方法并且之前没有人遇到这种情况?

I'll update here how that goes, but I wondered if there is a better way and has nobody been in this situation before?

我已经搜索了很多东西'重新生成ios文件夹''已删除的ios文件夹''将ios文件夹添加到现有文件夹中'并且没有任何帮助。也许我的googlefu不够好,但如果有人有任何建议,非常感谢。

I've googled lots of things 'regenerate ios folder' 'deleted ios folder' 'add ios folder to existing..' and nothing helpful. Maybe my googlefu isn't good enough but if anyone has any suggestions, much appreciated.

第2步将确保它编译因为依赖和东西,但现在我的目标是在项目中恢复/ ios文件夹,并让React Native知道它的存在(它有所有必要的配置)。

Step 2 will be making sure it compiles because of dependencies and stuff but for now my goal is to just get the /ios folder back in the project and for React Native to be aware of it's existence (it has all the necessary config).

谢谢

推荐答案

您需要遵循的流程与重命名本机应用程序非常相似。基本上你只需要在根项目目录中运行 react-native upgrade 。有关详细信息,您可以在此处查看另一个问题。下面的说明解释了如何基于具有新名称的复制项目创建另一个反应原生项目。

The process you need to follow is so similar to renaming a react native app. Basically you just need to run react-native upgrade in your root project directory. For further info you can check another question here. The instructions below explains how to create another react native project based on a copied one with a new name.


  • 首先复制您的目录-be-name-changed应用程序存在。并转到新克隆的目录。

  • 更改 index.ios / android.js 文件的名称,该文件作为参数提供到AppRegistry。

  • package.json上相应更改名称和版本

  • 删除 / ios / android 旧应用程序中剩余的文件夹。

  • 运行 $ react-native upgrade 生成 / ios / android 再次使用文件夹。

  • 对任何本机依赖项运行 $ react-native link

  • 最后运行 $ react-native run-ios 或任何你想要的东西。

  • First copy the directory which your to-be-name-changed application exists. And go to your newly cloned directory.
  • Change the name at index.ios/android.js file which is given as a parameter to AppRegistry.
  • Change the name and version accordingly on package.json
  • Delete /ios and /android folders which are remaining from your older app.
  • Run $react-native upgrade to generate /ios and /android folders again.
  • Run $react-native link for any native dependency.
  • Finally run $react-native run-ios or anything you want.

这篇关于如何在React Native项目中重新生成ios文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆