3

How can I add post_install script in podspec file of my custom cocoapod and execute code below?

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

I have an issue where I can not get a successful build when running pod spec lint because of dependencies of my cocoapod. When I remove those dependencies and run pod spec lint I get a successful build.

On images below is shown when script fails:

Image 1 Image 2

This is the reason why I wan't to execute post_install in podspec file. I'm not sure will this resolve the issue or should I look for some other solutions.

I've tried adding post_install like this but I get an error:

s.post_install do |installer|
    # your script here
end

but I get an error:

[!] Invalid `MyLib.podspec` file: undefined method `post_install' for #<Pod::Specification name="MyLib">

0 Answers0