在 MacOS 上构建 Flutter 应用程序时,我收到以下警告:
/Users/fractale/lut_viewer/macos/Pods/Pods.xcodeproj: warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.11, but the range of supported deployment target versions is 10.13 to 13.3.99. (in target 'nanopb-nanopb_Privacy' from project 'Pods')
/Users/fractale/lut_viewer/macos/Pods/Pods.xcodeproj: warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.11, but the range of supported deployment target versions is 10.13 to 13.3.99. (in target 'nanopb' from project 'Pods')
/Users/fractale/lut_viewer/macos/Pods/Pods.xcodeproj: warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.11, but the range of supported deployment target versions is 10.13 to 13.3.99. (in target 'PromisesObjC-FBLPromises_Privacy' from project 'Pods')
/Users/fractale/lut_viewer/macos/Pods/Pods.xcodeproj: warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.11, but the range of supported deployment target versions is 10.13 to 13.3.99. (in target 'PromisesObjC' from project 'Pods')
/Users/fractale/lut_viewer/macos/Pods/Pods.xcodeproj: warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.12, but the range of supported deployment target versions is 10.13 to 13.3.99. (in target 'GoogleUtilities-GoogleUtilities_Privacy' from project 'Pods')
/Users/fractale/lut_viewer/macos/Pods/Pods.xcodeproj: warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.12, but the range of supported deployment target versions is 10.13 to 13.3.99. (in target 'GoogleUtilities' from project 'Pods')
如果我打开
/Users/fractale/lut_viewer/macos/Pods/Pods.xcodeproj
,我可以将部署目标修改为 10.13,警告就会消失,但在 flutter clean
之后,问题会再次出现。该文件可能已生成。如何解决根本问题?目标的名称不是我直接使用的,但可能是我的依赖项使用的。
要解决此警告,您必须将 输出依赖项 添加到脚本阶段,或者通过取消选中脚本阶段中的基于依赖项分析将其配置为在每个构建中运行。 (在项目“Runner”的目标“Flutter Assemble”中)
在脚本阶段取消选中基于依赖分析: 导航到 Xcode 中目标的设置:
运行
flutter clean
,然后运行 flutter pub get
,然后运行 flutter run
,查看警告是否仍然存在。你可能会得到
插件“x”需要比 macOS 更高的最低部署版本 您的应用程序正在定位。
只需增加应用程序的部署目标,如下所述 https://docs.flutter.dev/deployment/macos
需要注意的是,虽然这种方法可以抑制警告,但它可能不是最好的解决方案