Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Synchronizing two targets in Xcode 4

Tags:

xcode

ios

Is there a quick way to synchronize two (or more) targets in Xcode? This becomes an issue when I forget to add a new file to my unit test & integration target. Then I have to go hunting to see what I forgot to add. I can duplicate my "development" target and then re-add the "unit testing" configuration, but that's a pain. Is there an easier way?

EDIT:

I like John's answer below but ultimately I used the answer from here, that involves manually editing the project file. With multiple missing files that was the quickest way.

like image 635
EightyEight Avatar asked Jun 12 '12 17:06

EightyEight


1 Answers

your question focuses on the case where you are adding a single file to a target, and forget to check both boxes to add it to the target you want.

perhaps you mean that it is a pain to use the identity inspector, but i think this is a handy way to add in one file that i didn't properly get added to a second target. you can get to the identity inspector by first clicking on the file for which you want to inspect information, and then using Cmd-Opt-1, and then clicking the rightmost tab. notice near the bottom that for me, both targets are checked. for you, in the case of a file that didn't get added to both targets, one will be unchecked.

identity inspector

in the case of not remembering which files you added recently to a target:

  • if you have your project under source control, you can perform "View" -> "Version Editor" -> "Show Version Editor" (or Cmd-Opt-Shift-Return), and you'll get a text-based diff comparison of the XML representing your project versus what it looked like at the last commit. whatever is new is likely the set of files to look at for the checkboxes as in the picture above.
  • if not under source control, you may have to go through the files one by one, though you might be able to use the finder to sort your source by Date Modified, and jog your memory as to the file you added, then go straight to that. in terms of going through one by one, once the identity inspector is open, you should be able to just click on the first file in the list, then use the down-arrow to step through all files, and see which are in the desired set of targets and which are not.
like image 181
john.k.doe Avatar answered Oct 02 '22 01:10

john.k.doe