我使用npm run eject
命令从expo弹出项目。它生成2个文件夹ios
和android
。我试图通过xcode
运行该项目,但它仍然显示此错误。也许我不清楚弹出后如何运行项目,您能帮我运行它吗?
我运行一些语句来安装pod
,但不能正常工作https://github.com/CocoaPods/CocoaPods/issues/2303
最佳答案
因此,在弹出时,应该已经为您提供了两种选择:
? How would you like to eject from create-react-native-app? (Use arrow keys)
❯ React Native: I'd like a regular React Native project.
ExpoKit: I'll create or log in with an Expo account to use React Native and the Expo SDK.
Cancel: I'll continue with my current project structure.
如果选择第一个(
React Native
),则打开Xcode项目并运行该应用程序应该没有问题(也没有要安装的Pod)。由于您的错误和注释表示相反,因此我可以假定您选择了选项2:Expokit
。为此,应该提示您一些有关建立Expo帐户或使用现有帐户的信息:
? How would you like to eject from create-react-native-app?
React Native: I'd like a regular React Native project.
❯ ExpoKit: I'll create or log in with an Expo account to use React Native and the Expo SDK.
Cancel: I'll continue with my current project structure.
An Expo account is required to proceed.
? It appears you're already logged in to Expo as ...
之后,您需要按照Developing With ExpoKit中的步骤进行操作。具体来说,要使iOS运行,您需要在运行
npm run eject
之后执行in this section的所有步骤。如果已完成所有操作,则在与Expo XDE或
exp
结合运行时,它应该可以正常工作。我现在已经对它们进行了测试,并且可以正常工作。仔细检查您的步骤,以确保您没有错过任何东西。否则,请编辑您的问题,并详细说明您所运行的命令,所拥有的其他依赖项等,因为我无法重现您的错误。
关于xcode - 如何将EXPO项目弹出到 native 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48843497/