消除警告
Ignoring duplicate libraries: '-lc++'
在pod中可能会有这样的警告存在, 如何消除这样的警告呢?
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
# 根据你的需求找到特定的第三方库 target,然后为它添加链接器 flags
# xxx 是需要的指定的三方库
if ['xxx', 'xxx'].include?(target.name)
# 添加额外的链接器 flags,比如 '-Xlinker', '-no_warn_duplicate_libraries'
config.build_settings['OTHER_LDFLAGS'] ||= ['$(inherited)', '-Xlinker', '-no_warn_duplicate_libraries']
end
end
end
end
可能还会有这样的警告存在, 虽然可以通知配置完成, 但是每次pod insall的时候, 又会重置回去, 我们在Podfile中配置如下方式就可以解决这个问题了
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 < 13.0
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
end
end
end