如何将文件夹引用添加到PBXGroup?

时间:2019-07-12 11:21:26

标签: ruby xcode xcode-project xcodeproj

我想使用ruby将“文件夹参考”添加到PBXGroup。在github.com/CocoaPods/Xcodeproj中找不到解决方案

   file_path = File.join(to_folder, folder_to_fetch)
    file_reference = destination_group.new_file(file_path, :group)

    project.native_targets.each do |target|
#        ... ???
    end

1 个答案:

答案 0 :(得分:0)

找到了解决方案-盲目的:

file_path = destination_folder_path 
file_reference = destination_group.new_file(file_path, :project)
file_reference.path = file_path 
file_reference.include_in_index = '0' 
file_reference.set_explicit_file_type('folder') 
file_reference.last_known_file_type = 'folder'

project.native_targets.each do |target| 
   target.add_resources([file_reference]) 
end 

project.save