简体   繁体   中英

Multiple targets sharing common files in an Xcode project

I would like to ask you guys what is the logic behind this:

When you create an app on Xcode 4, it creates a group with the same name of your app and put the delegate and viewController files inside it. It also puts all other files, including main.m and -prefix.pch inside a folder called Supporting Files.

If you create another target, it creates a similar structure for the other target. Now you have two AppDelegate files, two main.m files, two of everything what would be nice to maintain. I have a project with 4 targets, so in theory I would have 4 of everything, what is stupid.

In fantastic Xcode 3, you had just the needed files for multiple targets, not this mess. You had a directory Classes, where all classes were put. Just one copy.

If you try to rename the groups and moving files around to create a sane structure, you end dealing with hours and hours of troubles as files that don't compile, missing paths, and stuff like that.

I simply don't understand how this is better than what we have in Xcode 3.

Can someone explain this insanity?

Why you need to move files around. In my case with 2 targets project. I have 2 groups with same name of target which was created by Xcode. and I have a Common Group to place all the necessary files that shared by both targets(make sure this files' target membership pointed to both targets)

And you can duplicate a target to avoid configure similar settings again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM