gpt4 book ai didi

swift - 从 pod 访问父项目 OTHER_SWIFT_FLAGS

转载 作者:可可西里 更新时间:2023-11-01 01:18:46 25 4
gpt4 key购买 nike

为私有(private)框架构建自定义 pod,在我的主项目中我使用自定义 OTHER_SWIFT_FLAGS。

理论上应该可以在基于主项目的安装过程中覆盖 pod 的设置,但没有关于如何这样做的文档。

到目前为止我的尝试都失败了,有什么提示吗?看起来项目(https://guides.cocoapods.org/syntax/podfile.html#project)应该是可行的方法,但同样没有文档。

最佳答案

所以基本上它看起来像这样。访问 xcode 项目,然后访问 pod 并循环遍历每个配置以设置正确的值。

post_install do |installer|
require 'xcodeproj'
project_path = 'pathTo/myProj.xcodeproj' # path to your xcode project
project = Xcodeproj::Project.open(project_path)
project.targets.each do |target|
if target.name == 'myTarget' # name of the target in your main project containing the custom flag
installer.pods_project.targets.each do |podTarget|
if podTarget.name == 'myPod' #name of your pod
target.build_configurations.each do |targetConfig|
podTarget.build_configurations.each do |podConfig|
podConfig.build_settings["OTHER_SWIFT_FLAGS"] = targetConfig.build_settings["OTHER_SWIFT_FLAGS"]
end
end

end
end
end
end

关于swift - 从 pod 访问父项目 OTHER_SWIFT_FLAGS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44949852/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com