Flutterconnectivity_plus 包在 VS Code 中构建,但在 Xcode 中失败

问题描述 投票:0回答:1

我在使用connectivity_plus 包的 Flutter 项目中遇到了问题。当我从 Visual Studio Code 构建并运行项目时,一切在 iOS 模拟器和物理设备上都运行得很好。但是,当我尝试直接从 Xcode 构建相同的项目时,构建失败,并且没有与connectivity_plus相关的显式错误。

我尝试过的:

Running flutter pub get and ensuring all dependencies are up to date.
Checking that connectivity_plus is correctly added to my pubspec.yaml.
Cleaning the build folder in Xcode (Shift + Command + K) and removing derived data.
Ensuring that my Podfile is correctly set up and running pod install in the ios directory.
Running flutter clean followed by flutter build ios before opening the .xcworkspace file in Xcode.

尽管做出了这些努力,该项目还是在 VS Code 中成功构建,但当我尝试直接在 Xcode 中构建它时却失败了。 Xcode 中的错误消息并未指出connectivity_plus 的任何具体问题。这会导致一种特殊的情况,即应用程序从 VS Code 启动时运行良好,但无法在 Xcode 中构建。

问题:

是否有人遇到过类似的问题,或者是否有人深入了解可能导致 VS Code 和 Xcode 构建之间存在差异的原因?任何有关如何解决或解决此问题的建议将不胜感激。

环境详情:

Flutter version: 3.19.1
connectivity_plus version: 5.0.2
Xcode version: 15

提前感谢您的帮助和建议!

运行 flutter pub get 并确保所有依赖项都是最新的。 检查connectivity_plus是否正确添加到我的pubspec.yaml中。 清理 Xcode 中的构建文件夹(Shift + Command + K)并删除派生数据。 确保我的 Podfile 已正确设置并在 ios 目录中运行 pod install。 运行 flutter clean,然后运行 flutter build ios,然后在 Xcode 中打开 .xcworkspace 文件。

flutter xcode
1个回答
0
投票

我也遇到同样的问题,我花了很多时间试图解决它,但我无法解决它。

但我发现风味设置导致了这个错误。 https://github.com/flutter/flutter/issues/99438 这个链接帮助了我 https://docs.flutter.dev/deployment/flavors

© www.soinside.com 2019 - 2024. All rights reserved.