Flutter - iOS 模拟器部署目标“IPHONEOS_DEPLOYMENT_TARGET”设置为 7.0 && 无法找到构建输入文件 GoogleService-Info.pl

Posted

技术标签:

【中文标题】Flutter - iOS 模拟器部署目标“IPHONEOS_DEPLOYMENT_TARGET”设置为 7.0 && 无法找到构建输入文件 GoogleService-Info.plist【英文标题】:Flutter - The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0 && Build input file cannot be found GoogleService-Info.plist 【发布时间】:2020-09-01 12:05:32 【问题描述】:

我无法在 ios 模拟器上构建 Flutter 应用。我一遍又一遍地收到这个错误。我的颤振医生很干净。

 Launching lib/main.dart on iPhone SE (2nd generation) in debug mode...
    Xcode build done.                                           26,7s
    Failed to build iOS app
    Error output from Xcode build:
    ↳
        ** BUILD FAILED **
    Xcode's output:
    ↳
        error: Build input file cannot be found: '/Users/User/Downloads/GoogleService-Info.plist' (in target 'Runner' from project 'Runner')
        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 7.0, but the range of supported deployment target versions is 8.0 to 13.4.99. (in target 'AppAuth' from project 'Pods')
        warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 8.0 to 13.4.99. (in target 'GTMAppAuth' from project 'Pods')
        warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 8.0 to 13.4.99. (in target 'gRPC-Core' from project 'Pods')
        warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 8.0 to 13.4.99. (in target 'BoringSSL-GRPC' from project 'Pods')
        warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 5.0, but the range of supported deployment target versions is 8.0 to 13.4.99. (in target 'leveldb-library' from project 'Pods')
        warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 8.0 to 13.4.99. (in target 'gRPC-C++-gRPCCertificates-Cpp' from project 'Pods')
        warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 4.3, but the range of supported deployment target versions is 8.0 to 13.4.99. (in target 'nanopb' from project 'Pods')
        warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 8.0 to 13.4.99. (in target 'GTMSessionFetcher' from project 'Pods')
        warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 8.0 to 13.4.99. (in target 'gRPC-C++' from project 'Pods')
        warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 8.0 to 13.4.99. (in target 'abseil' from project 'Pods')
    Could not build the application for the simulator.
    Error launching application on iPhone SE (2nd generation).
    Exited (sigterm)

【问题讨论】:

【参考方案1】:

要消除此警告:

    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 8.0 to 13.4.99. (in target 'AppAuth' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 8.0 to 13.4.99. (in target 'GTMAppAuth' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 8.0 to 13.4.99. (in target 'gRPC-Core' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 8.0 to 13.4.99. (in target 'BoringSSL-GRPC' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 5.0, but the range of supported deployment target versions is 8.0 to 13.4.99. (in target 'leveldb-library' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 8.0 to 13.4.99. (in target 'gRPC-C++-gRPCCertificates-Cpp' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 4.3, but the range of supported deployment target versions is 8.0 to 13.4.99. (in target 'nanopb' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 8.0 to 13.4.99. (in target 'GTMSessionFetcher' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 8.0 to 13.4.99. (in target 'gRPC-C++' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 8.0 to 13.4.99. (in target 'abseil' from project 'Pods')

确保您的 Podfile 包含这一行

config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
    end
  end
end

为了使应用程序构建成功并摆脱:

error: Build input file cannot be found: '/Users/User/Downloads/GoogleService-Info.plist' (in target 'Runner' from project 'Runner')

删除并再次通过 Xcode 添加 GoogleService-Info.plist 文件。

【讨论】:

当我这样做时......我现在得到 - 在 /Users/mridley/_development/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-0.4 包含的文件中。 3+2/ios/Classes/FLTPackageInfoPlugin.m:5: /Users/mridley/_development/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-0.4.3+2/ios/Classes/FLTPackageInfoPlugin。 h:5:9: 致命错误:找不到“Flutter/Flutter.h”文件 - 有什么想法吗?【参考方案2】:

使用 Xcode 12 你可能已经看到了这个错误:

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.

发生这种情况是因为已放弃对 iOS 8 的支持,但 pod 的最低部署目标是 iOS 8。

在解决此问题之前,您可以将以下内容添加到您的 Podfile

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
end

这将从项目中的所有 pod 中删除部署目标,并允许它们继承已在 Podfile 顶部指定的项目/工作区部署目标。

【讨论】:

【参考方案3】:

对maxpills回答的一点改进

post_install do |installer|

  puts 'Determining pod project minimal deployment target'

  pods_project = installer.pods_project
  deployment_target_key = 'IPHONEOS_DEPLOYMENT_TARGET'
  deployment_targets = pods_project.build_configurations.map |config| config.build_settings[deployment_target_key] 
  minimal_deployment_target = deployment_targets.min_by |version| Gem::Version.new(version) 

  puts 'Minimal deployment target is ' + minimal_deployment_target
  puts 'Setting each pod deployment target to ' + minimal_deployment_target

  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings[deployment_target_key] = minimal_deployment_target
    end
  end
end

这是使用 Podfile 开头定义的目标版本

platform :ios, '9.0'

【讨论】:

你有一行写着'DEBUG=1'] 这在某种程度上是复制粘贴错误吗? :) 确定是@p0wl 所以真正的问题是:是否缺少半行或者我应该删除'DEBUG=1'] 您能否修复此答案中的语法错误。【参考方案4】:

    打开 Xcode 更改项目文档 -> 项目格式 -> Xcode 8.0-兼容 flutter clean, flutter pub 获取 Flutter 构建 iOS

【讨论】:

【参考方案5】:

对我来说,它在 XCode 中突出显示的字段中设置为 8.0,设置为 10 对我来说是固定的。

【讨论】:

【参考方案6】:

我稍微修改了@Hons 的回答,以解决我在 Xcode 12.5 中使用 OneSignal 和 uni_links 0.5.1 软件包时遇到的问题。

编辑./ios/Podspec 文件,取消注释第二行文件(并更新为最小目标版本):

# Uncomment this line to define a global platform for your project
platform :ios, '10.0'

然后将 OneSignal 和 post_install 脚本的目标代码替换为:

target 'OneSignalNotificationServiceExtension' do
  use_frameworks!
  pod 'OneSignalXCFramework', '3.2.1'
end

post_install do |installer|
  puts 'Determining pod project minimal deployment target'
  pods_project = installer.pods_project
  deployment_target_key = 'IPHONEOS_DEPLOYMENT_TARGET'
  deployment_targets = pods_project.build_configurations.map |config| config.build_settings[deployment_target_key] 
  minimal_deployment_target = deployment_targets.min_by |version| Gem::Version.new(version) 
  puts 'Minimal deployment target is ' + minimal_deployment_target
  puts 'Setting each pod deployment target to ' + minimal_deployment_target
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      config.build_settings[deployment_target_key] = minimal_deployment_target
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

【讨论】:

以上是关于Flutter - iOS 模拟器部署目标“IPHONEOS_DEPLOYMENT_TARGET”设置为 7.0 && 无法找到构建输入文件 GoogleService-Info.pl的主要内容,如果未能解决你的问题,请参考以下文章

Flutter ios pod install 更改部署目标

如何解决flutter中的iOS部署目标问题

Flutter App 无法在 IoS 模拟器上运行,运行器内有循环,并且 domain=NSPOSIXErrorDomain,code=63

Flutter Firebase——为 iOS、Android 和 Web 设置不同的部署目标

如何使用 Swift 包管理器更新 iOS 模拟器部署目标?

支持的部署目标版本范围是 9.0 到 14.55 Error While Running Flutter App on iOS Simulator