Skip to content

Instantly share code, notes, and snippets.

@tomredman
tomredman / Cocoapods-Build-Phase.md
Last active March 23, 2019 03:27
Add file to specific Pods' Frameworks Build Phase using cocoapods' post_install

In a large, nested project where I prefer to control the workspace, I run pod install --no-integrate on my root project. However, some pods don't include their required static libs correctly within their target's framework build phases.

For example, Pod-TestFlightSDK's required libTestFlight.a is excluded and removed every time I update my pods. Which required me to manually update the Pod target each time to include the static lib, which required me to automate it:

post_install do |installer_representation|
    installer_representation.project.targets.each do |target|
        if target.name == 'Pods-TestFlightSDK'
            libFile = installer_representation.project.new_file('TestFlightSDK/libTestFlight.a')
        end