CocoaPods / CocoaPods/Xcodeproj

Adding subproject product to copy files phase

Open
#247 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
2.4k
Forks
488
PR merge metrics
No merged PRs in 30d

Description

I'm not sure if this is an issue or a problem with my code but I'm attempting to create a new project, add a subproject to it and add a .bundle product of the sub project to the dependencies and the copy files phase.

Adding to dependencies works so the file references appear to be correct but adding the file to the copy files phase results in a "(null)" entry in the project.

My code is:

``` ruby
// Create a new project
proj = Xcodeproj::Project.new(outpath, false)

// Open the subproject
sublib_proj = Xcodeproj::Project.open('/Projects/Fuudey/iPhone/FuudeyLib/FuudeyLib.xcodeproj')

// Create a main group
group = proj.main_group.new_group(appname)

sub_project = group.new_file()
sub_bundle = sublib_proj.root_object.targets.select { |t| t.name == 'BundleProject' }[0]

// Add a new iOS native target
app_target = proj.new_target(:application, appname, :ios, '7.0')

// This works
app_target.add_dependency(sub_bundle)

// This doesn't
app_target.add_resources([sub_bundle.product_reference])
```

This appears to be correct from looking at the documentation but it doesn't work in practice. Am I missing something or is this a bug?

Thanks

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.