3

我无法在 iOS 模拟器上运行我的应用程序。从 Flutter 2.2.3 升级到 Flutter 2.5.0 后出现此错误

我无法从 Android Studio 运行 Flutter 应用程序。但如果从 Xcode 打开项目,则应用程序将在 iOS 模拟器中正常运行。

这是错误/警告消息

 ld: building for iOS Simulator, but linking in object file built for iOS, file '/Users/xxxxxxx/Documents/main_app/ios/Pods/GoogleMaps/Base/Frameworks/GoogleMapsBase.framework/GoogleMapsBase' for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.2.99. (in target 'FMDB' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.2.99. (in target 'libwebp' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.2.99. (in target 'TOCropViewController' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.2.99. (in target 'TOCropViewController-TOCropViewControllerBundle' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.2.99. (in target 'Reachability' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.2.99. (in target 'Mantle' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.2.99. (in target 'AppAuth' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.2.99. (in target 'GoogleSignIn' from project 'Pods')

我已经尝试了 SO 的几种解决方案,但没有运气。到目前为止我尝试过的

  1. 扑干净
  2. 删除 podfile.lock。遵循这个
  3. 删除模拟器中的应用

这是我的颤振医生

[✓] Flutter (Channel stable, 2.5.0, on macOS 11.2.1 20D74 darwin-x64, locale en-ID) [✓] Android 工具链 - 为 Android 设备开发 (Android SDK 版本 31.0.0) [✓] Xcode -为 iOS 和 macOS 开发 [✓] Chrome - 为网络开发 [✓] Android Studio(版本 2020.3)[✓] VS Code(版本 1.60.0)[✓] 连接设备(3 可用)

4

1 回答 1

0

将此代码添加到您的 Podfile:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 9.0
        config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
      end
    end
  end
end

您可以将 9.0 更改为项目的部署目标版本。

于 2021-09-16T06:34:57.380 回答