[英]react-native unable to push recent version of ios code to simulator
I am building a react-native application that should work in both the Android simulator and the iOS simulator. 我正在构建一个本机应用程序,该应用程序在Android模拟器和iOS模拟器中都应能正常工作。 I've been developing primarily on my Windows machine, and I would use command prompt
react-native run-android
to see my changes in an Android simulator. 我主要在Windows机器上进行开发,因此我将使用命令提示符
react-native run-android
在Android模拟器中查看更改。 Once in a while, I would go to my mac mini, do a git pull origin master
, and then run react-native run-ios
to see my changes in an iOS simulator. 偶尔,我会去Mac mini,做一个
git pull origin master
,然后运行react-native run-ios
在iOS模拟器中查看我的更改。
Everything has been working fine until a few days ago. 直到几天前,一切都工作正常。 Now when I'm on my mac mini, the following will happen:
现在,当我使用Mac mini时,将发生以下情况:
react-native run-android
from my terminal, I see my latest react-native changes in the android simulator, which is perfect react-native run-android
,我会在android模拟器中看到最新的react-native更改,这很完美 react-native run-ios
from my terminal, I see an EARLIER/OLDER version of my react-native changes of the ios simulator. react-native run-ios
,我会看到ios模拟器的react-native更改的早期版本/旧版本。 This is NOT what I want. react-native run-ios
command ignores my clearly broken project and continues to build the same earlier version of my react-native project and puts it in the ios simulator. react-native run-ios
命令将忽略我明显损坏的项目,并继续构建我的react-native项目的相同早期版本,并将其放入ios模拟器中。 I tried deleting the project, and doing a fresh new git pull, but still the same issue occurs and simulator shows the same earlier version of my project. Why won't my react-native run-ios
command build the latest version of my react-native code and put it in the ios simulator? 为什么我的
react-native run-ios
命令不会构建最新版本的react-native代码并将其放入ios模拟器中?
Ok, I found a workaround. 好的,我找到了解决方法。
I started a completely new react-native project with the react-native init <sameprojectnameasmybrokenproject>
. 我使用
react-native init <sameprojectnameasmybrokenproject>
开始了一个全新的react-native项目。 Then I copied all my react components and project files (The ones that I created, and not the stuff that react creates boiler templates for) and my package.json file from my broken project to my new project. 然后,我将我所有的React组件和项目文件(我创建的组件,而不是React为其创建锅炉模板的东西)和我的package.json文件从破碎的项目复制到了新项目。 Then I ran
react-native run-ios
to make sure this new project works fine. 然后,我运行了
react-native run-ios
以确保该新项目正常运行。
EDIT 编辑
I also copied these four files from my new project into my broken project, and it got the broken project to show the latest build versions again. 我还将这四个文件从我的新项目复制到破碎的项目中,它使破碎的项目再次显示最新的构建版本。
So something about these four files was broken in my broken project. 所以这四个文件在我坏掉的项目中坏了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.