Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
855 views
in Technique[技术] by (71.8m points)

iphone - When compiling for multiple targets in XCode, how do i ensure that certain files will not be included one target

I searched for a long time on stackoverflow using every keyword I could think of to solve this. I am programming for iphone and I have a lite and paid version of my app. I followed the instructions here Creating Lite Versions of iPhone Games / Apps for duplicating the target. This works and now I am working on slimming down the lite version.

Main problem? Images. The lite version needs to have several hundred less images than the paid version. So, I made 2 groups in XCode. One "Folder Group" in Xcode - named "FreeImages" and another "ProImages". I want all FreeImages only to be included in the lite app and all FreeImages and ProImages to be in the paid app. I do not care that XCode considers these Groups to be Virtual Folders. I reversed the instructions to a point and have an environment flag (-D) set in XCode "PLUS_VERSION" I want XCode to basically do the following:

If (PLUS_VERSION)
{
 copy contents of FreeImages *and* ProImages where normally they go
}
else
{
copy contents of FreeImages where they normally go.
}

Anyone know where to start to tell XCode to conditionally copy contents of groups into the target?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

For each resource (or folder of resources) you want to direct to a specific target, you can click on the resource and inspect it (either via right-clicking and selecting Get Info or by clicking on the Inspect toolbar option). Within that info dialog will be a tab called Targets, where you can check the targets you want the resource (or even source code file) to be incorporated into, and uncheck the ones you don't.

Alternatively, I believe you can navigate to the target itself in Xcode, click on the triangle next to its name to expand the list of build phases, expand the Copy Bundle Resources build phase, and manually delete from the list there any resources you don't wish to have copied over into that target.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...