有没有办法在中添加构建设置cocoapods
pod 无需直接更改 Pods 项目或其他自动生成的内容,因此在之后它仍然会存在pod install
?具体来说,我需要设置DISABLE_MIXPANEL_AB_DESIGNER=1
在 Mixpanel pod 中以避免崩溃。
我发现了一些东西here,但它已经过时并且看起来很奇怪,因为(据我所知)podspec
文件是由 pod 所有者而不是用户创建的。
谢谢,@Hodson,这是解决方案。稍微修改了示例文档, we get
post_install do |installer|
#Specify what and where has to be added
targetName = 'Mixpanel'
settingKey = 'DISABLE_MIXPANEL_AB_DESIGNER'
settingValue = 1
#Find the pod which should be affected
targets = installer.pods_project.targets.select { |target| target.name == targetName }
target = targets[0]
#Do the job
target.build_configurations.each do |config|
config.build_settings[settingKey] = settingValue
end
end
只需将此代码添加到您的 podfile 中即可。显然,以同样的方式,您可以对自动生成的 pod 项目进行任何更改,并且它们永远不会丢失。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)