How do you automate do “Copy Files” in Build Phases using a Cocoapods Post Install Script?

跟風遠走 提交于 2019-12-13 04:48:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!