(This is a simplified description of a very large project)
I have an XCode project that has two targets. The only difference between the two targets is there is a different implementation of a a viewcontroller for each target.
The view controller has a xib and is just a simple view with a UITextView inside. Let's call it TextReportViewController.
Implementation "A" has printing, so it has a button that allows you to print the contents of the UITextView. It is in a group called "A".
Implementation "B" has email, so it has a button that allows you to email the contents of the UITextView. It is in a group called "B".
Target "A" includes in its "compile sources" the .m file from group "A" and "Copy Bundle Resources" takes the xib from group "A".
Target "B" includes in its "compile sources" the .m file from group "B" and "Copy Bundle Resources" takes the xib from group "B".
I added "B" after "A", that is, before I decided I wanted another target things were working with "A".
When I edit "B" xib file and I examine the "file's owner" and in the identity inspector I click on the arrow for the custom class type it goes to "A's" .m file, not "B's" .m file.
When I look at the outlets for the file's owner it is a combination of the outlets from "A" and "B".
I added a control to "B's" xib and in the assistant editor I had the "B's" .h file shown and I drag a button to it to create an IBOutlet and it puts it in "A's" .h file instead.
What will I have to do to make sure target A is using A's .h file and xib file and target B is using B's .h file and xib file.
Note that when I added target "B" it made a folder called "B". So the files are located like this:
Root:
TextReport:
TextReportViewController.m
TextReportViewController.h
TextReportViewController.xib
B:
TextReport:
TextReportViewController.m
TextReportViewController.h
TextReportViewController.xib
Also when I am editing the "B" xib file and I show the assistant editor and select "automatic" to show the .h and .m files, it shows four, the two .h files and the two .m files.
I suspect you can't have this kind of setup. Even though each of your targets uses a different copy of your VC, you have to have both copies of the files with the same name in your Xcode project. This is when the confusion begins. When you specify the owner of a xib in IB, you provide the name of the class, but not the path to the file where it's defined. So you can't really know which of the two files is being used.
I'd suggest using different names for different targets.