首先查看官方文档
brew install node
brew install watchman
npm install -g yarn react-native-cli
- 新建项目
cd desktop
react-native init AwesomeProject
cd AwesomeProject
react-native run-ios
- 错误信息:React/RCTBridgeDelegate.h' file not found
error Could not find "Podfile.lock" at /Users/zhanghuan/Desktop/AwesomeProject/ios/Podfile.lock. Did you run "pod install" in iOS directory?
info Found Xcode project "AwesomeProject.xcodeproj"
info Launching iPhone 11 (iOS 13.1)
info Building (using "xcodebuild -project AwesomeProject.xcodeproj -configuration Debug -scheme AwesomeProject -destination id=F866A062-4F9E-412C-B272-5832A81E3631 -derivedDataPath build/AwesomeProject")
.......................................
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening AwesomeProject.xcodeproj. Run CLI with --verbose flag for mo
** BUILD FAILED **
The following build commands failed:
CompileC /Users/zhanghuan/Desktop/AwesomeProject/ios/build/AwesomeProject/Build/Intermediates.noindex/AwesomeProject.build/Debug-iphonesimulator/AwesomeProject.build/Objects-normal/x86_64/AppDelegate.o /Users/zhanghuan/Desktop/AwesomeProject/ios/AwesomeProject/AppDelegate.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
![](https://img.haomeiwen.com/i5176625/681d697d2fc16a12.png)
解决:
安装pod
AwesomeProject目录下ios文件夹
cd ios
pod install
关掉模拟器,重新执行
cd ..
react-native run-ios
![](https://img.haomeiwen.com/i5176625/fe89dbab773d2a06.png)
网友评论