[英]The iOS deployment target is set to 7.0, but the range of supported deployment target versions for this platform is 8.0 to 12.1. (in target 'React')
[英]The iOS Simulator deployment targets is set to 7.0, but the range of supported deployment target version for this platform is 8.0 to 12.1
您可以设置您的 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
您可以删除每个 pod 的 pod 部署目标,而不是在 pod post install 中指定部署目标,这会导致部署目标从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
迭代来自 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
如果有人从 react native 问题来到这里,只需删除 /build 文件夹并输入react-native run ios
我们可以将项目部署目标应用于所有 pod 目标。 通过将此代码块添加到 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
结果日志:
尝试以下步骤:
cd /ios
pod install
这对我有用。
如果您来自react-native
并面临此错误,请执行此操作
Podfile
(你的项目 > ios>Podfile)#use_flipper!
#post_install do |installer|
#flipper_post_install(installer)
#end
IOS
文件夹内的终端中输入此命令pod install
是的,就是希望它对你有用
如果有人在更新到最新的 react native 时遇到问题,请尝试更新您的 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
对于斯威夫特
如果你在 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" />
在Flutter中对我有用的简单修复:
Podfile
和Podfile.lock
Podfile
。 这可能仍然会因错误而失败。Podfile
中,取消注释并将第二行更改为platform :ios, '12.0'
(或您要定位的其他最小版本)该解决方案适用于Flutter 。 打开{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
您需要做的就是取消注释以下行
# platform :ios, '8.0'
或者
# platform :ios, '9.0'
ETC...
然后在终端中打开 iOS 文件夹并传递这些命令:
% pod repo update
% pod install
看起来这是CocoaPods的一个问题(至今仍未解决): https : //github.com/CocoaPods/CocoaPods/issues/7314
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
对于有此问题的科尔多瓦开发人员
尝试设置
<preference name="deployment-target" value="8.0" />
在 config.xml 中
以上大部分内容对我不起作用。 如果您四处挖掘,您会发现您不应该手动运行 pod install 。 对我有用的是确保我的物理设备已使用 xcode 注册。
这就是我用 Firebase 10.1 和 Xcode 14.1 解决这个问题的方法:
Product
> Analyze
以获取所有IPHONEOS_DEPLOYMENT_TARGET
警告Terminal
: pod cache clean --all && pod deintegrate && pod install --repo-update
Perform Changes
按钮在 Firebase 项目库中对此有详细的讨论。
首先将部署更改为您的选择:例如“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 更新到 v13 后在 2021 年遇到这个问题,这里有一个对我有用的修复程序:
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
Xcode > Runner > Info 部署目标 > IOS 部署目标:11。
打开终端:
pod cache clean --all
.
pod update
(颤动)在我的例子中,我不小心导入了 dart.js,所以如果它刚才还在工作,它只是在重新加载或重新启动时停止,请检查你的导入
对于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
这是 M1 MacBook 上的一个已知问题。 运行颤振升级,应该可以解决它。
目前正在开发 M1 Mackbook 12.0.0 Flutter 2.10.0 Dart 2.16.0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.