更新到 Xcode 13 测试版,现在由于几个 pod 中的错误,我无法构建项目
较旧的 Xcode 在 iOS 15 上启动应用程序的时间过长
我使用 M1,也许这是由于架构
这句话不是一个实际的错误,只是一个警告。真正的错误可以在嵌套Compile Swift source files
在同名的顶层部分下找到。展开此命令的日志,您应该会看到实际错误。
在我的项目中,pods 部署目标仍然是iOS 8.0
. 我添加了以下内容以Podfile
升级它们 iOS 13。然后我清理项目并删除了派生数据。添加以下脚本后,您需要调用pod install
.
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 update
,它为我解决了这个问题
将 SwiftMessages pod 版本从 8.0.2 更新到 9.0.4(不适用于 Swift 5.5)对我有帮助
我做了 Product -> Clean,然后 Xcode -> Preferences -> Locations -> Derived Data,转到目录并删除所有内容。然后关闭 Xcode 并重新打开并进行我的构建(存档)。一切都好。
这对我有帮助。developer.apple.com 的答案 在 Podfile 中添加此内容
$iOSVersion = '11.0'
post_install do |installer|
# add these lines:
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=*]"] = "armv7"
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = $iOSVersion
end
installer.pods_project.targets.each do |target|
# add these lines:
target.build_configurations.each do |config|
if Gem::Version.new($iOSVersion) > Gem::Version.new(config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'])
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = $iOSVersion
end
end
end
结尾
我发现这是由于框架和项目优化构建设置之间的不匹配。
要修复它,应该优化项目的目标,例如-Os in BuildSettings -> Apple Clang Code Generation -> Optimisation Level
在您的项目目标上
如果将编译模式设置为整个模块,似乎 swift 会进行优化。Eray 的答案有效,但可能无法为框架的发布版本创建最佳的程序集/位码。
项目级编译模式也需要是 Whole module。
还注意到如果依赖顺序不正确,可能会发生这种情况。在并行构建期间,如果尚未构建依赖项的所需依赖项,则可能会出现此错误。通过明确添加到第一级家属Build Phases->Link with Libraries
列表来修复。
我按照atalaysaPodfile
的建议进行了更新。
然后 Preferences > Derived Data > Force Quit Xcode > Deleted Derived Data > Pod Install > Opened the Xcode project > Let the project run through indexing > Archived successful.
确保您的 pod 与您的项目的 swift 版本相同。