ios - Xcode 构建失败 : Requested but did not find exte

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

如果你能帮助我,我将不胜感激。这是我的第一个 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(安装程序) __apply_Xcode_12_5_M1_post_install_workaround(安装程序)
    结束

  5. (仅适用于官方 react-native 设置):运行 pod update

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

首先要注意的是:底层错误是由 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 修复该错误.就我而言,我必须从 Apple Developer Website 手动安装 Xcode 命令行工具。 .接下来,Xcode 必须使用 sudo xcode-select -s/Library/Developer/CommandLineTools 集成这些下载的命令行工具。重新启动 Xcode 并按照 react-native 的官方设置指南进行操作后,您将面临另一个构建错误。

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

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

关于ios - Xcode 构建失败 : Requested but did not find extension point,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72160143/

相关文章:

r - 在嵌套列表中从第一个列表中选择第一个元素,从第二个列表中选择第二个元素,依此类推

r - 根据特定列中的数据框条目添加新列的最快方法是什么

awk - 用键分隔行并存储在不同的文件中

arrays - 将 + 或 += 与 array#map 一起使用?

module - 是否有一种简洁/内联的方式来创建 Set 值而不显式命名它们的类型?

python - 在 Python 中用正则表达式替换 '(' 时出错

c++ - 如何从析构函数返回变量

nuxt.js - 如何在 Nuxt 3 中间件获取当前域?

python - 如何找到具有最少步数的元素

python - 为什么有些功能pass了