我在 Xcode 12 上收到此警告:
iOS Simulator 部署目标
IPHONEOS_DEPLOYMENT_TARGET设置为 8.0,但支持的部署目标版本范围为 9.0 到 14.0.99
如何支持这个版本?
一个简短的工作解决方案就在这里!只需将下面的代码片段复制并粘贴到 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 < 12.0
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
end
end
end
end
在这种情况下,12.0 是 AppStore 提交的最低支持 iOS 版本。您可以根据项目要求对其进行更改。
这是可可豆荚中目标的问题。对我来说,答案是将此代码放在 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
它解决了我所有的问题,编译和归档项目。
另一种方法是更改IPHONEOS_DEPLOYMENT_TARGET pods 项目中的 ,如下图所述:
更新:要解决此问题,您只需Deployment Target将9.0. 这可以通过打开.xcworkspace文件来更新,Pods.xcodeproj在 Xcode 上选择,然后更新iOS Deployment Target到9.0或更高版本,如下图所示。
另一个简单的解决方法是将以下内容添加到您的目录中并在终端上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
上一篇:除非您导入支持文件,否则您无法为iOS 8.0on提供支持。Xcode 12要默认提供支持,您必须使用Xcode 11. 最好检查使用您的应用程序的用户数量iOS 8并将支持的最低版本更新到iOS 9或更高版本。
发生这种情况是因为Xcode 12中已放弃对iOS 8的支持,但有问题的 pod 的最低部署目标仍然是 iOS 8。这记录在Xcode 12 发行说明中:
弃用
- Xcode 现在支持在运行iOS 9.0及更高版本的 iOS 设备上调试应用程序和运行测试。
解决方法。您现在可以将以下内容附加到您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.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
end
end
这将从使用 iOS 8 或更低版本的所有 pod 中删除部署目标设置,允许它们简单地继承您在Podfile. 例如:
platform :ios, '10.0'
Flutter 现在需要一条额外的线路才能在 2021 年末开始工作。
将下面更新的代码片段粘贴到 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
注意:如果您的 podfile 中有以下代码,请将其替换为上述代码。
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
我还需要添加
s.platform = :ios, "9.0"
到我的.podspec文件以使其正常工作,以及来自上述(或以下)任何答案的 post_install 脚本。
注意:s.platform 是
s.platform = :ios
我正在使用 Flutter,所以我的步骤:
对于反应本机用户:
node_modules文件夹yarn installPods 文件夹和Podfile.lock里面的文件(在 ios 文件夹里面)ios终端的文件夹并运行pod install无需变通方法