创建 React Native 项目并在Xcode运行
2022-05-11 本文已影响0人
Qy_iOS
1.搭建开发环境(官网:https://www.react-native.cn/docs/environment-setup)
![](https://img.haomeiwen.com/i9162753/29dd61d0a2058a6f.png)
2.xcode cocoaPods 安装,以及M1注意事项
![](https://img.haomeiwen.com/i9162753/bcbc0eeff9c23863.png)
3.创建项目,以及注意事项
![](https://img.haomeiwen.com/i9162753/808b565437ca0f7d.png)
4.运行项目
![](https://img.haomeiwen.com/i9162753/3d92523398b8e2f2.png)
5.运行结果
![](https://img.haomeiwen.com/i9162753/f8ad85fc4214e3d1.png)
6.概括
正常来说按照官方文档操作是没有问题的,但是在运行途中难免会出现问题。
比如:
![](https://img.haomeiwen.com/i9162753/32872fa269ff7717.png)
临时解决方案:打开iOS目录下的podfile
将 # post_install do |installer|
# react_native_post_install(installer)
# __apply_Xcode_12_5_M1_post_install_workaround(installer)
# end
这段代码全部注掉后,在重新运行。
![](https://img.haomeiwen.com/i9162753/bb3b0ecff9df9dfb.png)