Post_Install hook in .podspec file to change BUILD_LIBRARY_FOR_DISTRIBUTION to YES?
Asked Answered
B

2

8

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.

Burke answered 16/3, 2021 at 14:56 Comment(3)
Have you managed to solve it? Let me knowFilum
@ViktorVostrikov unresolved issue, let me know if you find any solution.Obstetric
have you found any solution?Epiphany
S
-4
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
Sweatbox answered 14/12, 2021 at 10:15 Comment(0)
L
-4

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
Literally answered 18/5, 2022 at 6:52 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.