Cod3rMax
Cod3rMax

Reputation: 958

Change target ios version when installing new pod

Whenever I install a new pod project, and for example I install firebase libraries I always get installed libraries to be targeted for projects 8.0 or and I start changing them manually to be 9.0 or 14.0 because of the warning that I'm Getting.

Warning Errors

Here it is the Podfile content:

 platform :ios, '14.0'

target 'TestProject' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for TestProject

        pod 'SDWebImageSwiftUI'
        pod 'lottie-ios'
        pod 'Firebase/Auth'
        pod 'Firebase/Firestore'
end

How it is possible to update target iOS all at once, so I won't be updating all the libraries one by one?

Upvotes: 2

Views: 3725

Answers (2)

Gereon
Gereon

Reputation: 17882

Depending on your Podfile, Warren's answer might not be enough to set all targets to the new deployment target. I recommend using this post-install handler:

deployment_target = '14.0'

post_install do |installer|
    installer.generated_projects.each do |project|
        project.targets.each do |target|
            target.build_configurations.each do |config|
                config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = deployment_target
            end
        end
        project.build_configurations.each do |bc|
            bc.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = deployment_target
        end
    end
end

This addition becomes important when you use options like install! 'cocoapods', :generate_multiple_pod_projects => true

Upvotes: 2

Warren Burton
Warren Burton

Reputation: 17378

Add this to your Podfile and then pod install.

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

This will update all the Pod targets at once to your desired version.

Upvotes: 3

Related Questions