问题
I know this is a rather trivial question, but I seem to be having the worst time with this.
I've tried :
obj = Xcodeproj::Project::Object::PBXCopyFilesBuildPhase.new(PATH, 10)
target.build_phases.add(obj)
But the UUID is 0 and nothing is added to the Build Phases. Can someone please help me. I know the rest of my setup is correct.
回答1:
Here's my example:
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)
来源:https://stackoverflow.com/questions/34367048/how-do-you-automate-do-copy-files-in-build-phases-using-a-cocoapods-post-insta