ios – XCode项目:如何从终端删除/添加文件(脚本,命令等)
发布时间:2020-12-14 19:40:37 所属栏目:百科 来源:网络整理
导读:有没有办法在不使用XCode的情况下从XCode项目中删除文件或将文件添加到XCode项目?也就是说,是否有任何终端命令或程序可以做到这一点?我知道我可以做cp mv和rm来添加/删除文件,但它们没有反映在实际的项目文件中. 谢谢! 解决方法 有一个名为 xcodeproj的 R
有没有办法在不使用XCode的情况下从XCode项目中删除文件或将文件添加到XCode项目?也就是说,是否有任何终端命令或程序可以做到这一点?我知道我可以做cp mv和rm来添加/删除文件,但它们没有反映在实际的项目文件中.
谢谢! 解决方法
有一个名为
xcodeproj的
Ruby Gem允许在命令行操作XCodeProject.
查看Using the Xcodeproj Ruby Gem,它提供了向项目添加文件的示例. # Open the existing Xcode project project_file = product_name + '.xcodeproj' project = Xcodeproj::Project.new(project_file) # Add a file to the project in the main group file_name = 'Message.m' group_name = product_name file = project.new_file(file_name,group_name) # Add the file to the main target main_target = project.targets.first main_target.add_file_references([file]) # Save the project file project.save_as(project_file) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |