I have a Copy Bundle Resources build phase which contains 200 resources. And now I have to make a new target as different kind. (app -> static lib) So unfortunately, I can't just duplicate the target :(
Anyway it's nonsense adding each resources one-by-one by hand. I tried to duplicate them at once but all I did failed. I made a new window and tried to drag them into the new target's phase, but it didn't worked.
How can I copy the Copy Bundle Resources build phase to another target? The target is in same project, so there is no file referencing problem.
Changing the target name is just as simple. Click on the project name at the top left, then select a target name on the right pane followed by pressing "Enter".
To view the build phases for a target, select the target and navigate to the Build Phases tab, as shown in the following figure. To add a new build phase, click the Add button (+) and select an appropriate build phase from the pop-up menu. Xcode disables any menu options that aren't valid.
To view and add dependencies, select a target and open its build phase settings. The Dependencies build phase contains the targets that Xcode must successfully build before it builds the current target. Xcode can build multiple dependent targets simultaneously if there are no interdependencies between those targets.
I solved this by opening my .pbxproj
file in a text editor and doing some hunting for the right lines related to my target.
It's tricky, because Xcode uses a system of ids to populate the project file (ps. I did this while migrating from Cocoapods to Carthage, so I'm not using that setup)
It takes a little work finding the id of your target, but in Xcode 9, you should have something similar to
targets = (
EDBC6D6D1E0150850033868B /* target 1 */,
EDF960C71E1963E0001A29CE /* fancy target */,
EDF960D71E196DF3001A29CE /* Service Extension */,
);
in the /* Begin PBXProject section */
section that describes the project. Search the .pbxproj
file for your id to find the similarly structured buildPhases
that lists ids for your targets build phases.
buildPhases = (
47120FBF1F4343A900C27821 /* Sources */,
4712100B1F4343A900C27821 /* Frameworks */,
4712100D1F4343A900C27821 /* Resources */,
471210251F4343A900C27821 /* ShellScript */,
476673451F5F1ACD00567450 /* Embed App Extensions */,
);
Now, find where the required id (in OPs case, Resources) and you'll find the list of resources. You can compare these to the list of your source target and copy and paste.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With