Cocoapods荚稳定build立设置

有没有办法在cocoapods pod中添加生成设置,而不需要直接更改Pods项目或其他自动生成的东西,所以在pod install后它仍然会到位? 具体来说,我需要在Mixpanel窗格中设置DISABLE_MIXPANEL_AB_DESIGNER=1来避免崩溃。

我在这里find了一些东西,但它已经过时了,看起来很奇怪,因为(据我所知) podspec文件是由pod所有者创build的,而不是用户创build的。

谢谢,@霍德森,这是解决scheme。 稍微修改文档的例子,我们得到

 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 

只需将此代码添加到您的pod文件。 显然,以同样的方式,您可以对自动生成的豆荚工程进行任何更改,而且它们不会丢失。