Reputation: 85975
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.
Upvotes: 14
Views: 4562
Reputation: 1968
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.
Upvotes: 3
Reputation: 1552
What version of Xcode? Did the new target start as a template, or empty?
What does it mean for a static library to have a "copy bundle resources" build phase? Wouldn't it would use the resources of the thing that it's linked into?
Upvotes: 0