5

A partner and I are managing an Xcode project via Git. He recently "localized" the project, which added a directory for German ("de.lproj") to the project with a number of files. After I pulled those changes over to my copy of the project, Xcode now fails to compile complaining that two files in this directory don't exist. These files are present in the filesystem, but displayed as red (missing) in the Xcode sidebar.

Is there a way to force Xcode to rebuild it's internal catalog of files so that it can "rediscover" that these files are, indeed, present?

Note, I've tried a fresh "clone" of this Git project as well, same result.

4
  • Are these files really missing on your machine? Commented Jul 23, 2012 at 15:03
  • Nope, they are present. However, I just noticed that Xcode is trying to use absolute paths to reference these two files, and of course my partner and I have different absolute paths. I'm going to try deleting and reintroducing these files, maybe Xcode will use the "group" paths this time. Commented Jul 23, 2012 at 15:24
  • This is an XCode problem, it might be because you have move those files to a different directory. A fast way to resolve the issue is by removing the missing file references in XCode, and re-adding those files from file system. Commented Jul 23, 2012 at 15:33
  • Thanks, Neevek, we just landed on that solution ourselves and I've posted an answer to that effect below. Good call! Commented Jul 23, 2012 at 15:53

4 Answers 4

7

I found a solution without removing the file from Xcode -

  1. In the Project Navigator, locate the file (colored red for not being found) and highlight it.
  2. Show the File Inspector
  3. Under Location change Absolute Path to Relative to group or Relative to project,
  4. Then next to the path, there's a little white icon, click it and choose the file's location.
Sign up to request clarification or add additional context in comments.

Comments

4

This turned out to be a case of absolute vs. group paths memorized in the project.pbxproj file by Xcode. For reasons I do not understand, when my partner localized our project, some files were added to Xcode using absolute paths. When I pulled that version of the project, my copy of Xcode could not find those files because the absolute path did not match my absolute path. Even though the files were in the project and transferred properly by Git, Xcode could not find them.

My solution was to use Xcode to delete these files. Since these were localized files, I actually had to delete the "parent" version of the localized files. I told Xcode to only remove the references to the files. Then I dragged the files from Finder back into Xcode. This time Xcode inserted them as "relative to group" and all was well.

I committed and pushed those changes back to our remote Git repository. My partner was able to pull those to his copy and all worked for him too.

Neither of us understand why the files were inserted as absolute references in the first place, but at least we were able to use this workaround to make the project portable again.

Comments

1

I had this issue and i fixed it just by quitting xcode and reopening it. All the missing files magically reappeared. Hope this will help some one.

Comments

0

Check the project folder path. If any of the folder name in the path contains a 'space' then remove it and open the project again. I had this issue with Xcode 9.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.