使用 CocoaPods 时的 Xcode 12 部署目标警告

atu*_*n23 38 xcode warnings cocoapods xcode12

我在 Xcode 12 上收到此警告:

iOS Simulator 部署目标IPHONEOS_DEPLOYMENT_TARGET设置为 8.0,但支持的部署目标版本范围为 9.0 到 14.0.99

如何支持这个版本?

gri*_*ian 41

一个简短的工作解决方案在这里!只需将下面的代码片段复制并粘贴到 Podfile 的末尾,然后运行pod install命令。

    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['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
            end
         end
     end
  end
Run Code Online (Sandbox Code Playgroud)


And*_*nes 18

这是可可豆荚上的目标的问题。对我来说,答案是将此代码放在 pod 文件的末尾:

 post_install do |installer|
     installer.pods_project.targets.each do |target|
         target.build_configurations.each do |config|
             config.build_settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf'
             config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
             config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
         end
     end
  end
Run Code Online (Sandbox Code Playgroud)

它解决了我所有的问题,编译和归档项目。

另一种方法是更改IPHONEOS_DEPLOYMENT_TARGETpods 项目中的 ,如下图所示:

在此处输入图片说明 此致。

  • 我认为只有这一行是必要的:`config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'` (7认同)

bm8*_*888 10

从 2021 年底开始,Flutter 现在需要一条额外的线路才能运行。

将下面更新的代码片段粘贴到 Podfile 末尾并运行 pod install 命令。

  post_install do |installer|
     installer.pods_project.targets.each do |target|
         flutter_additional_ios_build_settings(target)
         target.build_configurations.each do |config|
            if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 10.0
              config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
            end
         end
     end
  end
Run Code Online (Sandbox Code Playgroud)

注意:如果您的 podfile 中有以下代码,请将其替换为上面的代码。

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end
Run Code Online (Sandbox Code Playgroud)


Bib*_*cob 6

更新:要解决此问题,您只需Deployment Target9.0. 这可以通过打开.xcworkspace文件,Pods.xcodeproj在 Xcode 上选择,然后更新iOS Deployment Targetto9.0或更高版本来更新,如下图所示。

在此处输入图片说明

另一个简单的解决方法是将以下内容添加到您Podfilepod install在终端上运行的目录中。

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['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
        end
     end
 end
Run Code Online (Sandbox Code Playgroud)

上一篇:除非导入支持文件iOS 8.0Xcode 12否则无法提供对on的支持。要默认提供支持,您必须使用Xcode 11. 最好检查使用您的应用程序的用户数量iOS 8并将支持的最低版本更新为iOS 9或更高版本。