Xcode 构建失败:已请求但未找到扩展点

Xcode build fail: Requested but did not find extension point

我按照官方的 react-native 设置指南设置了我的 react-native 项目。 (安装所有必需的软件包 + npx react-native init MyProject + npx react-native start(终端 1)+ npx react-native run-ios(终端 2))但是,我在尝试构建 ios 应用程序时遇到错误。 似乎没有帮助。

如果你能帮助我,我将不胜感激。这是我的第一个 react-native 设置,所以我不知道如何修复该错误。

这是 运行 npx react-native run-ios:

时的完整输出

(base) Lucas-MacBook-Pro-2:MyProject luca$ npx react-native run-ios info Found Xcode workspace "MyProject.xcworkspace" info Launching iPhone 13 (iOS 15.2) info Building (using "xcodebuild -workspace MyProject.xcworkspace -configuration Debug -scheme MyProject -destination id=D3DC5A60-6CB5-40B5-B610-4760B38C1941") 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 MyProject.xcworkspace. Command line invocation: /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace MyProject.xcworkspace -configuration Debug -scheme MyProject -destination id=D3DC5A60-6CB5-40B5-B610-4760B38C1941

User defaults from command line: IDEPackageSupportUseBuiltinSCM = YES

note: Using new build system note: Planning Analyze workspace

Create build description Build description signature: 58652ba6d5e25b644cfcef8d1c74529a Build description path: /Users/luca/Library/Developer/Xcode/DerivedData/MyProject-eqgmgatmlgqlskcmpchtodpmmbab/Build/Intermediates.noindex/XCBuildData/58652ba6d5e25b644cfcef8d1c74529a-desc.xcbuild

note: Build preparation complete note: Building targets in dependency order error: unable to attach DB: error: accessing build database "/Users/luca/Library/Developer/Xcode/DerivedData/MyProject-eqgmgatmlgqlskcmpchtodpmmbab/Build/Intermediates.noindex/XCBuildData/build.db": database is locked Possibly there are two concurrent builds running in the same filesystem location.

2022-05-08 12:19:42.347 xcodebuild[2512:185622] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore 2022-05-08 12:19:42.353 xcodebuild[2512:185622] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore ** BUILD FAILED **

要检查所有版本信息,这里是npx react-native info的输出:

System: OS: macOS 12.0.1 CPU: (8) x64 Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz Memory: 31.59 MB / 8.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 14.16.1 - /usr/local/bin/node Yarn: Not Found npm: 6.14.12 - /usr/local/bin/npm Watchman: 2022.03.21.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: Not Found IDEs: Android Studio: 3.5 AI-191.8026.42.35.5977832 Xcode: 13.3.1/13E500a - /usr/bin/xcodebuild Languages: Java: 16.0.1 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.68.1 => 0.68.1 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

快速修复:

  1. https://developer.apple.com

    手动下载 Xcode 命令行工具
  2. 使用sudo xcode-select -s /Library/Developer/CommandLineTools

    激活下载的命令行工具
  3. 重启Xcode

  4. (仅适用于官方 react-native 设置):注释掉 ios/Podfile:
    中的这些行 use_flipper!()
    # post_install do |installer|
    react_native_post_install(installer) __apply_Xcode_12_5_M1_post_install_workaround(installer)
    end

  5. (仅针对官方react-native设置):运行 pod update

错误描述: 我终于能够解决这个问题。由于我只是按照 here 所述的 MacO 设置指南进行操作,我认为详细说明我为解决上述问题所做的工作很有用。有些人可能会遇到同样的困难。

首先要注意的是:根本错误是由Xcode本身引起的。

error: unable to attach DB: error: accessing build database [...]

只是输出中其他两个错误的结果,即

Requested but did not find extension point with identifier Xcode [...]

这些错误发生在 运行 首次申请时。尝试重新启动应用程序时,程序的较早实例仍会尝试访问导致错误的数据库。

因此,我将解释如何修复缺少的依赖项 Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOSXcode.DebuggerFoundation.AppExtensionHosts.watchOS。我发现如何根据 this Apple Community post. In my case, I had to manually install Xcode Command Line Tools from the Apple Developer Website 修复该错误。接下来,Xcode 必须使用 sudo xcode-select -s /Library/Developer/CommandLineTools 集成这些下载的命令行工具。重新启动 Xcode 并遵循 react-native 的官方设置指南后,您将面临另一个构建错误。

会发生此错误,因为初始 Xcode 配置与 npm react-native init MyProject 在 ios 上生成的 Podfile 冲突。要解决此问题,请注释掉 podfile 中的行(请参阅 4.)并在 运行 pod update 之后,您的 react-native 设置应该最终起作用。

我希望我能够帮助一些迷路的开发人员,他们想开始为 ios 应用程序使用 React Native。

在我的例子中,我只是在 Xcode 首选项中 select 命令行工具