How to find all files in Xcode that are NOT part of the target

One of the most common problems that I encounter with multiple goals is to forget to add the file to all goals. Its easy to import the file and do not tick off all the fields ...

Many targets

In the build phases, there is a view of 'compile sources', which is a list of files compiled for each purpose. However, seams cannot be an easy way to compare targets to see which files are in one but not the other.

Is there a way to find files that are NOT members of a specific target? Is a script possible?

+6
source share
5 answers

I don’t know the path to the script, but for the file you can see a list of all targets with the specified targets, and you can check or unmark the targets from this list.

Open the Utilities panel and select File Inspector. Then select the file, and the corresponding targets will be in the target membership area of ​​the file inspector.

You can even select multiple files and targets that are associated with some, but not all selected files will be marked with a “-”. If you check the target, all selected files will be added to this target.

+2
source

I built a tool that allows you to extract files that are in objects

https://github.com/ConfusedVorlon/ProjectFileTool

You can compare this to finding .m files in the project directory.

+2
source

In Xcode 8, listing files from Target → Build Phases → Compile Sources gave a list of files for each target, but there was no easy way to find the missing ones. Selecting all files and copying them allows you to copy physical files to a temporary directory. After that, with two goals in separate folders, duplicates can be deleted until only files that are missing for another purpose are left in each folder.

I just had “this class is not a key value compatible with the encoding for the key” failure caused by the file not being included in the target, so I had to find the missing files. Ineffective or elegant solution, but it did its job.

+1
source

If you don’t know which files you added to the target, you can go to the “Generate phases →“ Compile sources ”section (or any other section that has differences). Then select everything and click copy. Paste this into the diff program, select another target and repeat.

0
source

I don’t know (completely) fast and simple, but if you were after the script, I have a library that could do it here: https://github.com/jasperblues/XcodeEditor

0
source

Source: https://habr.com/ru/post/919656/


All Articles