简体   繁体   English

如何在 react-native 中重置 IOS 文件夹

[英]How to Reset IOS folder in react-native

I'm working on a react-native application, I made some mistakes on the iOS project side.我正在开发一个 react-native 应用程序,我在 iOS 项目方面犯了一些错误。 Android goes well and no problems. Android运行良好,没有问题。 I would like to know if there is any solution to completely reset the iOS project without losing the Android project.我想知道是否有任何解决方案可以完全重置iOS项目而不会丢失Android项目。

When running the react-native run-ios command, the iOS simulator starts and remains locked in info IDEDerivedDataPathOverride运行react-native run-ios命令时,iOS 模拟器启动并保持锁定在info IDEDerivedDataPathOverride

What I tried to do:我试图做的事情:

cd ios
pod deintegrate
pod install

-------- the same problem, did not work --------同样的问题,没用

I check on npm and I found a package react-native-clean-project and i ran: ./node_modules/.bin/react-native-clean-project --remove-iOS-build我检查了 npm,发现了一个包react-native-clean-project并运行: ./node_modules/.bin/react-native-clean-project --remove-iOS-build

-------- the same problem - - - - 同样的问题

rm -rf ios/build 

-------- the same problem - - - - 同样的问题

and in last thing i remove the node_modules folder, install it again, clean the cache, but is the same problem...最后我删除了 node_modules 文件夹,再次安装,清理缓存,但是同样的问题......

I want to make a fresh ios folder, like when create a fresh project, but just for iOS.我想创建一个新的 ios 文件夹,就像创建一个新项目时一样,但仅适用于 iOS。

Delete /ios folders删除 /ios 文件夹

Run $react-native upgrade to generate /ios folder again.运行$react-native upgrade再次生成 /ios 文件夹。

Run $react-native link运行$react-native link

Run $react-native run-ios .运行$react-native run-ios

This is my solutuion... (partially)这是我的解决方案...(部分)

Downgrade the version of my repo, i pulled 2 commits behind降级我的 repo 版本,我拉了 2 个提交

The after i tried to do:在我尝试做之后:

watchman watch-del-all && 
rm -rf $TMPDIR/react-native-packager-cache-* &&
rm -rf $TMPDIR/metro-bundler-cache-* && 
rm -rf node_modules/ 
&& npm cache clean --force &&
npm install
npm start -- --reset-cache

(but i have some errs on watchman, is something like “watch-dell-all” si not a common command) (但我对守望者有一些错误,类似于“watch-dell-all”之类的不是常用命令)

Then after a tried this:然后在尝试了这个之后:

sudo npm cache clean —force

npm install —save

react-native run-ios

No result here, so i decided to remove node_modules and after that to install via yarn (i don't know why) but after this i finally open my project in Xcode when i'we made a build from Xcode.. I've linked again with react-native link after that now, i can run react-native run-ios but i have some errors on FBSDKShareKit, i'm working now to solve that.这里没有结果,所以我决定删除 node_modules,然后通过 yarn 安装(我不知道为什么),但是之后我终于在 Xcode 中打开了我的项目,当我从 Xcode 进行构建时......我已经链接了之后再次使用 react-native 链接,我可以运行 react-native run-ios 但我在 FBSDKShareKit 上有一些错误,我现在正在努力解决这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2025 STACKOOM.COM