且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

npx pod-install返回“此项目不支持CocoaPods".

更新时间:2023-01-03 20:29:28

出现错误的原因是因为您正在使用Expo构建自己的React-Native项目.

The reason you are getting the error is because you are building your React-Native project with Expo.

Expo将本机代码推算在远离您的地方,因此您不必处理本机代码.另外,Expo项目不允许您编辑本机代码. Cocoapods将本机代码添加到您的应用程序中,因此这就是您遇到错误的原因.

Expo extrapolates the native code away from you so that you don't have to deal with native code. Also an Expo project does not allow you to edit native code. Cocoapods add native code to your app, so this is why you are getting your error.

如果您希望在Expo项目中使用视频,则应查看Expo附带的内容,视频文档为

If you wish to use video in an Expo project then you should look at what is provided with Expo, the documentation for video is here.

如果这不符合您的需求,并且您需要使用react-native-video,那么您将需要从Expo中获取项目eject,以使其成为完整的React-Native项目.这不是您应该轻而易举地采取的步骤,而无需首先进行充分研究.

If this doesn't suit your needs and you need to use react-native-video then you will need to eject your project from Expo so that it becomes a full React-Native project. This is not a step that you should do lightly, and without fully researching it first.

我还建议您熟悉此 SO问题解释了Expo和React-Native之间的区别

I would also suggest you familiarise yourself with the answers to this SO question that explains the differences between Expo and React-Native