您如何自动执行“复制文件”操作?在使用Cocoapods安装后脚本的构建阶段中? [英] How do you automate do "Copy Files" in Build Phases using a Cocoapods Post Install Script?

查看:134
本文介绍了您如何自动执行“复制文件”操作?在使用Cocoapods安装后脚本的构建阶段中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这是一个相当琐碎的问题,但是我似乎遇到了最糟糕的情况。

I know this is a rather trivial question, but I seem to be having the worst time with this.

我尝试过:

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

但是UUID为0,并且未将任何内容添加到构建阶段。有人可以帮帮我吗。我知道其余设置正确无误。

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.

推荐答案

这是我的示例:

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)   

这篇关于您如何自动执行“复制文件”操作?在使用Cocoapods安装后脚本的构建阶段中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆