我在 Xcode 12 上收到此警告:
iOS 模拟器部署目标
设置为8.0,但支持的部署目标版本范围为9.0至14.0.99IPHONEOS_DEPLOYMENT_TARGET
这个版本如何支持?
这里有一个简短的工作解决方案!只需将代码片段复制并粘贴到 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
它解决了我所有的问题,编译并存档了项目。
另一种方法就是更改 pods 项目中的
IPHONEOS_DEPLOYMENT_TARGET
,如下图所示:
更新:要解决此问题,您只需将
Deployment Target
更新为 9.0
。可以通过打开 .xcworkspace
文件,在 Xcode 上选择 Pods.xcodeproj
,然后将 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.0
上提供对 Xcode 12
的支持。要默认提供支持,您必须使用 Xcode 11
。最好检查在 iOS 8
上使用您的应用程序的用户数量,并将支持的最低版本更新为 iOS 9
或更高版本。
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
发生这种情况是因为 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'
我还需要补充
s.platform = :ios, "9.0"
到我的 .podspec 文件,以及来自上述(或以下)答案中的 post_install 脚本。
注:s.platform 是
s.platform = :ios
我正在使用 Flutter 所以我的步骤: