我可以编码一个Android应用程序,然后用react native构建一个IOS应用程序吗



我开始学习本地反应,在设置环境时遇到了一些问题,我对此有一些问题:

第一次写:

npx react-native init new_app

我得到一个错误,这个错误说尝试:

cd ./new_app/ios && pod install

然后我得到以下错误:

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-apple-darwin-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for arm-apple-darwin-gcc... /Library/Developer/CommandLineTools/usr/bin/cc -arch armv7 -isysroot
checking whether the C compiler works... no
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: unable to lookup item 'Path' in SDK 'iphoneos'
/Users/macbookpro/Library/Caches/CocoaPods/Pods/Release/Flipper-Glog/0.3.6-1dfd6/missing: Unknown `--is-lightweight' option
Try `/Users/macbookpro/Library/Caches/CocoaPods/Pods/Release/Flipper-Glog/0.3.6-1dfd6/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: in `/Users/macbookpro/Library/Caches/CocoaPods/Pods/Release/Flipper-Glog/0.3.6-1dfd6':
configure: error: C compiler cannot create executables
See `config.log' for more details

我知道我需要安装Xcode,但由于某些原因,我现在不想安装,那么,在没有安装Xcode的情况下,我能做些什么让它正常工作吗?

第二个问题,我如何首先初始化一个只针对Android的react原生应用程序?如果有办法的话,当我想构建IOS应用程序时,我会遇到一些麻烦吗?或者我只需要Xcode,然后为IOS构建相同的android代码?或者环境应该为IOS和Android做好准备,然后开始使用您的应用程序?

要回答您的第一个问题,如果您想为IOS构建应用程序,则需要Xcode。

为了回答你的另一个问题,它完全有可能为android而不是IOS构建。它们的构建过程在很大程度上彼此独立运行。我会帮你省去在这里为android构建和开发的所有步骤,但文档应该能为你提供所需的一切。https://reactnative.dev/docs/running-on-device

相关内容

最新更新