7

I have a private pod framework and it has some dependencies. I wanted to change BUILD_LIBRARY_FOR_DISTRIBUTION for all dependencies in that framework.

In a Podfile, I have this post_install hook that does this work, but I wanted to know how can I do this in podspec.

Podfile:

post_install do |installer|
  installer.pods_project.targets.each do |target|
   target.build_configurations.each do |config|
    config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
   end
  end
 end

In podspec, I have tried this:

spec.pod_target_xcconfig = { 'BUILD_LIBRARY_FOR_DISTRIBUTION' => 'YES' }

and this:

spec.xcconfig  =  = { 'BUILD_LIBRARY_FOR_DISTRIBUTION' => 'YES' }

But none of these change it for all dependencies in framework.

Also, upon searching, I found that this https://guides.cocoapods.org/syntax/podspec.html#prepare_command could be used to convert post_install hook. Unfortunately, I couldn't figure out how. Any help would be appreciated. Thanks in advance.

2 Answers2

-2
post_install do |installer|
 installer.pods_project.targets.each do |target|
  if ["MyFramework"].include? target.name
   target.build_configurations.each do |config|
    config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
   end
  end
 end
end
-2

Solution: Use this code, the error comes due to line break ruby did not read those code given into payfort.pdf new release v3.1.0 100% working for me

post_install do |installer|
 installer.pods_project.targets.each do |target|
  if ["PayFortSDK"].include? target.name
   target.build_configurations.each do |config|
    config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
   end
  end
 end
end