skip to Main Content

I have target Main and aggregate target Script. Main target contains all files and installed pods. Script target contains only one build phase:

image

When I build target, it don’t find pods. I tried to install in Podfile like

target 'Script' do
    pod 'Periphery', '= 2.14.1'
end

but it return error that aggregate target is not target and can’t find it: Unable to find a target named "Script" in project

Copied from https://github.com/CocoaPods/CocoaPods/issues/11972#issuecomment-1614373016

Update: structure looks like Project Main and two targets in it:

enter image description here

2

Answers


  1. An aggregate target may contain a custom Run Script build phase or a Copy Files build phase, but it cannot contain any other build phases. Any build settings that the aggregate target contains are not interpreted but are passed to the build phases that the target contains.

    Xcode defines a special type of target that lets you build a group of targets at once, even if those targets do not depend on each other. An aggregate target has no associated product and no build rules. Instead, an aggregate target depends on each of the targets you want to build together. For example, you may have a group of products that you want to build together. You would create an aggregate target and make it depend on each of the product targets. To build all the products, just build the aggregate target.

    Login or Signup to reply.
  2. In Xcode, an aggregate target is not a traditional target that you can directly build or run. It is used to organize and manage other targets within a project. Aggregate targets cannot have their own build phases or dependencies.

    If you have a requirement to use CocoaPods in a specific build phase of an aggregate target, you can achieve this by following these steps:

    Create a new regular target (e.g., a framework target) in your Xcode project. Let’s call it "ScriptTarget".
    Add the necessary build phases to "ScriptTarget" and configure them as needed.
    In the Podfile, specify the required pods for "ScriptTarget" as follows:

    Copy code
    target 'ScriptTarget' do
      # Your pod dependencies for the ScriptTarget
      pod 'Periphery', '= 2.14.1'
    end
    

    Run pod install in your project’s directory to install the pods for "ScriptTarget".
    In the aggregate target, add a new build phase (e.g., a Run Script phase) where you can execute the necessary script or command that depends on the "ScriptTarget" and its pods.
    Now, when you build the aggregate target, it will execute the build phases of the "ScriptTarget" as part of its process, allowing you to use the required pods in the designated build phase.

    Remember, aggregate targets are not meant to be built directly, so you’ll need to run the build on a regular target within your project hierarchy that includes the desired build phases and dependencies.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search