你如何实现自动化"复制文件"使用Cocoapods Post Install脚本构建阶段?

时间:2015-12-19 03:45:52

标签: cocoapods xcodeproj

我知道这是一个相当微不足道的问题,但我似乎遇到了最糟糕的时间。

我试过了:

obj =  Xcodeproj::Project::Object::PBXCopyFilesBuildPhase.new(PATH, 10)
target.build_phases.add(obj)

但是UUID为0并且没有任何内容添加到Build Phases。有人可以帮帮我吗。我知道我的其他设置是正确的。

1 个答案:

答案 0 :(得分:1)

这是我的例子:

phase = target.new_copy_files_build_phase()

# Contrary to the docs (see http://www.rubydoc.info/github/CocoaPods/Xcodeproj/Xcodeproj/Project/Object/PBXCopyFilesBuildPhase) I believe this is not a path, but rather a code, e.g., 16 indicates to copy the file to the Products Directory.
phase.dst_subfolder_spec = "16"

fileRef = project.new(Xcodeproj::Project::Object::PBXFileReference)
fileRef.path = 'Server.plist'

phase.add_file_reference(fileRef)