如何在 post 安装中的 Pod 项目中添加文件夹引用?

How to add a folder reference in my the Pod project in post install?

因此,我正在尝试在由 cocoapods 创建的目标中添加文件夹引用。

我找到了这个解决方案,但它对我不起作用。 https://github.com/CocoaPods/CocoaPods/issues/3521

我在 cocoapods 0.39。而且我只将 projects 更改为 pods_project 因为它已被弃用。

还有 运行 pod update 时如何启用日志记录。我试过 pod update --verbose,但我的 puts 没有显示。 :/

===========更新===========

post_install do |installer|
    puts "printing tests"
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        if target.name == "TargetWhereToAddTheFolderOrFileReference"
          source_files = target.source_build_phase.files
          folderReference = installer.project.add_file_reference("/AbsolutePath/To/FileOrFolder", installer.project.pod_group("PodGroupWhereToAddTheFileOrFolder"), true)
          target.source_build_phase.add_file_reference(btsdata, true)
        end
      end
    end
end

post_install do |installer|
    // another post install script is here.
end

我附上了失败的脚本,而且它下面还有另一个 post_install 脚本。 puts "printing tests" 也没有被调用....

===========更新结束===========

哦,我认为脚本只会执行最后一个 post_install 而不会 两个都。可以把第一个post_install里面的代码放到最后一个吗?