作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
为私有(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/
这是我的 pod 文件: platform :ios, '8.0' use_frameworks! target 'TestApp' do ... end 在 pod install 之后,我收到
为私有(private)框架构建自定义 pod,在我的主项目中我使用自定义 OTHER_SWIFT_FLAGS。 理论上应该可以在基于主项目的安装过程中覆盖 pod 的设置,但没有关于如何这样做的文档
我是一名优秀的程序员,十分优秀!