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
if target.name == 'Pods-Brightcove-Player-SDK'
libFile = installer_representation.project.new_file('Brightcove-Player-SDK/Library/libBCOVPlayerSDK.a')
end
unless libFile.nil?
puts " - Adding %s to %s Frameworks Build Phases" % [libFile, target.name]
target.frameworks_build_phase.add_file_reference(libFile)
end
end
end
I use target.add_system_framework(installer.pods_project.targets.find{|target| target.name == 'YouFrameworkName'}) in my pod, but can't run success.
An error occurred while processing the post-install hook of the Podfile.
undefined local variable or method `frameworks_build_phase' for #Xcodeproj::Project::Object::PBXAggregateTarget:0x007fd7fb488d68
Did you mean? frameworks_build_phases