我在Xcode 10.1中得到了下面的警告信息。

iOS Simulator部署目标设置为7.0,但此平台支持的部署目标版本范围为8.0到12.1。

我的模拟器操作系统是12.1 Xcode 10.1

我更新了pod文件。

我的部署目标是9.0

在我的目标中


我解决了这个问题,我把build system从New build system改为Legacy build system

在Xcode v10+中,选择文件>项目设置

在之前的Xcode中,选择File > Workspace Settings

将Build System从New Build System更改为Legacy Build System—>单击Done。

试试下面这些步骤:

删除Podfile.lock 删除你的Podfile 建设项目 从firebase添加初始化代码 cd / ios 圆荚体安装 运行项目

这对我来说很管用。

问题是在你的pod文件部署目标iOS版本中,而不是在你的项目部署目标iOS版本中,所以你需要改变你的pod的部署iOS版本到8.0以上的任何版本,这样就可以打开你的项目工作区并这样做:

1-点击pods。

2-选择每个项目和目标,并单击构建设置。

3-在“部署”部分将iOS部署目标版本更改为8.0以上的任何版本 (最好尝试相同的项目版本)。

4-对你的pod中的其他项目重复这个步骤,然后运行应用程序。

详情见照片

您可以设置您的podfile自动匹配所有podfile的部署目标到您当前的项目部署目标,如下所示:

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

如果有人从react native issue来这里,只需删除/build文件夹并输入react-native run ios

对于有此问题的cordova开发者

试着设置

<preference name="deployment-target" value="8.0" />

在config . xml

迭代Tao-Nhan Nguyen的答案,计算每个pod的原始值集,只在它不大于8.0时调整它……在Podfile中添加以下内容:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if Gem::Version.new('8.0') > Gem::Version.new(config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'])
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '8.0'
      end
    end
  end
end

无需在pod安装后指定部署目标,您可以为每个pod删除pod部署目标,这将导致部署目标从Podfile继承。

您可能需要运行pod install以使效果发生。

platform :ios, '12.0'

  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

我们可以将项目部署目标应用于所有pods目标。 通过在Podfile的末尾添加以下代码块来解决:

post_install do |installer|
  fix_deployment_target(installer)
end

def fix_deployment_target(installer)
  return if !installer
  project = installer.pods_project
  project_deployment_target = project.build_configurations.first.build_settings['IPHONEOS_DEPLOYMENT_TARGET']

  puts "Make sure all pods deployment target is #{project_deployment_target.green}"
  project.targets.each do |target|
    puts "  #{target.name}".blue
    target.build_configurations.each do |config|
      old_target = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET']
      new_target = project_deployment_target
      next if old_target == new_target
      puts "    #{config.name}: #{old_target.yellow} -> #{new_target.green}"
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = new_target
    end
  end
end

结果记录:

如果你来自react-native,遇到这个错误,就这样做

打开Podfile(你的项目> ios>Podfile) podfile中的注释翻转函数如下所示

#use_flipper!
 #post_install do |installer|
   #flipper_post_install(installer)
 #end

在终端内的IOS文件夹中输入此命令吊舱安装

是的,就是这样,希望对你有用

如果有人在更新到最新的react本机时遇到问题,请尝试更新pod文件

  use_flipper!
  post_install do |installer|
    flipper_post_install(installer)
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
      end
    end
   end

首先将部署更改为您所选择的:例如'11.0' 并将此步骤添加到pod文件的最后

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

为迅速

如果你在Xcode 12中使用CocoaPods,那么你可能会看到这个错误:

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顶部指定的项目/工作区部署目标。

对于React Native

删除。/project-root/ios/build文件夹,输入react-native run ios

为科尔多瓦

<preference name="deployment-target" value="8.0" />

简单的解决方案,对我来说在颤振:

删除Podfile和Podfile.lock 运行app:这将创建一个新的Podfile。这可能仍然会失败并报错。 在新的Podfile中,取消注释,并将第二行更改为平台:ios, '12.0'(或其他你想要目标的最小版本) 再次运行应用程序,现在没有错误

这个方法在扑动的时候对我很有效。打开{your_project_root_folder}/ios/Podfile,用这个替换post_install块

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

对于Flutter使用这个

platform :ios, '10.0'

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

您所需要做的就是取消下面这一行的注释

# platform :ios, '8.0'

OR

# platform :ios, '9.0'

等等……

然后打开终端的iOS文件夹,传递这些命令:

% pod repo update
% pod install

如果有人在2021年将XCode更新到v13后遇到这个问题,这里有一个对我有效的修复方法:

https://github.com/facebook/react-native/issues/31733#issuecomment-924016466

然而,这可能不适用于所有react-native版本,它在v0.64上为我工作。

我用Xcode创建了一个虚拟swift文件,所以我自动得到了一个“桥接头”的请求

希望这个问题能在未来的版本中得到解决。

我在构建React Native项目时也遇到了同样的问题

Cocoapods版本更新对我有效(从1.8.4升级到1.11.2)

对我有用:

rm ios/Podfile
flutter pub upgrade
flutter pub get
cd ios && pod update
flutter clean && flutter run
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install 

以上的大部分方法对我都不起作用。如果你挖掘周围,你会发现你不应该手动运行pod安装。对我来说,有效的方法是确保我的物理设备在xcode中注册。

打开ios的xcode工作区。选择你的设备(最可能是通过usb连接的),然后单击运行。这将提示你让xcode注册你的设备。 Xcode构建很可能会失败,这没关系-请参见下一步 Xcode辞职! cd ios rm -fR Podfile Podfile。锁豆荚 在android studio中选择有问题的设备和c

这是M1 macbook上的一个已知问题。运行颤振升级应该就能解决问题了。

目前致力于 M1 Mackbook 12.0.0 颤振2.10.0 飞镖2.16.0

Xcode > Runner >信息部署目标> IOS部署目标:11 .

开放终端:

pod cache clean --all

.

pod update

在我的情况下,我不小心导入了dart.js,所以如果它刚刚在重新加载或重新启动时停止工作,请检查您的导入

这是我用Firebase 10.1和Xcode 14.1解决这个问题的方法:

打开Xcode 选择Product > Analyze,得到所有IPHONEOS_DEPLOYMENT_TARGET警告信息 打开终端,在你的项目目录:

Pod缓存清理-所有&& Pod分解&& Pod安装-回购-更新

再次检查Xcode。所有的警告都应该消失,Xcode的一个警告应该出现:“更新到推荐设置” 单击Perform Changes按钮 重启Xcode

在Firebase项目存储库中对此有详细的讨论。

对于flutter,这是我在<project_root>/ios/Podfile中使用的

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
  
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS"] = "armv7"
    config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
  end
end