首先执行react-native info查看我的电脑环境是:
React Native Environment Info:
System:
OS: macOS 10.15.5
CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
Memory: 103.91 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.22.12 - ~/.nvm/versions/node/v12.22.12/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v12.22.12/bin/yarn
npm: 6.14.16 - ~/.nvm/versions/node/v12.22.12/bin/npm
Watchman: 2023.01.30.00 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 27, 29, 33
Build Tools: 27.0.3, 29.0.2, 33.0.1
System Images: android-22 | Google APIs Intel x86 Atom, android-24 | Google APIs Intel x86 Atom, android-24 | Google Play Intel x86 Atom, android-27 | Intel x86 Atom_64, android-27 | Google Play Intel x86 Atom, android-31 | Google APIs Intel x86 Atom_64, android-33-ext4 | Google Play Intel x86 Atom_64
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8193401
Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild
npmPackages:
react: 16.6.0-alpha.8af6728 => 16.6.0-alpha.8af6728
react-native: 0.57.4-fc-0.0.2 => 0.57.4-fc-0.0.2
npmGlobalPackages:
create-react-native-app: 3.8.0
react-native-cli: 2.0.1
然后执行react-native run-ios报以下错:
** BUILD FAILED **
The following build commands failed:
CompileC /Users/apple/project/1.rn/mobile-crm/ios/build/Build/Intermediates.noindex/RNZipArchive_fix_build_error.build/Debug-iphonesimulator/RNZipArchive_fix_build_error.build/Objects-normal/x86_64/RNZipArchive.o /Users/apple/project/1.rn/mobile-crm/node_modules/react-native-zip-archive/ios/RNZipArchive.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/MobileCRM.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/MobileCRM.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/MobileCRM.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
at checkExecSyncError (child_process.js:635:11)
at Object.execFileSync (child_process.js:653:15)
at /Users/apple/project/1.rn/mobile-crm/node_modules/react-native/local-cli/runIOS/runIOS.js:208:5
at processTicksAndRejections (internal/process/task_queues.js:97:5)
查阅百度的stackoverflow办法不适用于我的环境和项目ios - Print: Entry, ":CFBundleIdentifier", Does Not Exist - Stack Overflowhttps://stackoverflow.com/questions/37461703/print-entry-cfbundleidentifier-does-not-exist
最后参考了这个文章
“Print: Entry, ":CFBundleIdentifier", Does Not Exist”_天海悬月的博客-CSDN博客
1.下载替换文件
官网boost_1_63_0.tar.gz下载地址(网速慢): Version 1.63.0
csdn的boost_1_63_0.tar.gz下载地址: boost-1-63-0.tar.gz完整版下载-MacOS文档类资源-CSDN下载
2.替换文件~/.rncache/目录下的boost_1_63_0.tar.gz
3.执行命令获取hash值并复制备用:
shasum ~/.rncache/boost_1_63_0.tar.gz
4. 打开项目目录地址文件并修改 node_modules/react-native/scripts/ios-install-third-party.sh:
5. 重新 react-native run-ios
到这步骤一般都能成功,如果还不行,继续往下看
6. 替换rncache所有的文件, 参考文章:
关于Entry, ":CFBundleIdentifier", Does Not Exist的解决方法_eagle-py的博客-CSDN博客_cfbundleidentifier
升级xcode10.0, 终端运行 运行报错:Print: Entry, “:CFBundleIdentifier”, Does Not Exist
**下载完有zip后缀的记得解压缩**
1.folly-2016.10.31.00.tar
2.glog-0.3.5.tar
3.boost_1_63_0.tar.gz
4.double-conversion-1.1.6.tar
下载后,如果是zip尾缀,双击解压;
如果是tar尾缀, 执行下gzip xxx.tar的压缩命令。
最后替换.rncache目录下的文件,重新开始执行步骤3按照boost_1_63_0.tar生成hash方式生成其他文件的hash并替换。