在 Xcode 中使用 Swift 包管理器为 Flutter 项目添加依赖项时出现构建错误

时间:2021-01-23 20:50:02

标签: ios swift xcode flutter

在我的 Flutter 项目中,我需要在我的项目的原生 iOS 部分添加依赖项。

为此,我使用 Swift 包管理器。

但是每次我尝试运行我的应用程序时,在添加依赖项后,我都会收到以下构建错误:

ProcessException: Process exited abnormally:
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -list


xcodebuild: error: Could not resolve package dependencies:
  Packages are not supported when using legacy build locations, but the current project has them enabled.
  Command: /usr/bin/xcodebuild -list

更多详情here

由于我是 iOS 开发的新手,我如何在 Xcode 中添加依赖项以使 Flutter 应用程序正常工作?

谢谢。

1 个答案:

答案 0 :(得分:4)

我想我可以为您解决问题。

请在 XCode 中关闭您的工作区,然后返回并打开 .xcworkspace 文件的 .xcodeproj 文件。

(最有可能是/yourApp/ios/Runner.xcodeproj)

项目打开后,在 XCode 菜单栏中点击 File -> Project Settings -> Advanced。

将选项从 LEGACY 更改为 XCODE DEFAULT。

现在再次打开 .xcworkspace,它应该可以工作了!

相关问题