Xcode 8 - Missing Files warnings

Ever since upgrading to Xcode 8 using Swift 2.3 I have several missing files warnings. They are all related to pods that I am using.

The files that are missing are

*.xcscheme
*.cpp
*.xcuserstate
*.swift

The pods that are showing missing files are

  • Realm (~38 of 43)
  • TextFieldEffects (~3 of 43)
  • BEMCheckBox (2 of 43)

How do I fix this issue?

50064 次浏览

How about commit in Source Control.

You may firstly have to show Packet Contents of "your project name".xcodeproj and show Packet Contents of project.xcworkspace and then delete the xcuserdata folder.

If you still cannot commit because of Couldn't communicate with a helper application problem then under your project directory try the following:

xcrun git config user.name "Your Name"
xcrun git config user.email YourEmailAddress

*Remember to reopen the project to see the effect.

This is just an Xcode bug. If you delete or rename a file without then doing a commit, Xcode sees the discrepancy between the previous git commit and the current state of things and reports these warnings. They go away as soon as you do a git add that includes the file deletion / rename.

If you don't use Xcode source control but some other git client (like source tree or terminal), you can disable source control in Xcode and then the warnings will disappear.

Xcode > Preferences > Source control and uncheck "Enable source control"

I had the same problem. In my case there was a .git directory in a parent directory of my project. By deleting that parent .git directory, the errors where gone.

In my case Pods where checked into the repository generating a couple hundred warnings for "missing files". Fixed it by removing Pods from the repo :

git filter-branch --index-filter 'git rm --cached --ignore-unmatch Pods/*' --tag-name-filter cat -- --all

I solve the problem simply by this:

  1. Add the culprit to the project enter image description here

  2. Remove the reference enter image description here

This cleans the internal state of XCode and the message goes away.

You can resolve the issue by checking "Add and Remove files automatically" option in X-Code->Preferences->Source Control

Here is the screenshot of Preferences

I've had this problem a few times now and finally I had it after doing ugly workarounds! I sat down and tracked it until I found the reason to it and were the references are stored!

As someone already proposed it has to do with version control, well yes and no, in some cases, it definitely have to do with poking around with files directly using the finder or whatever (but not from XCode)

Here's a quick fix that saves a lot of trouble and swear words!

Delete this file: ./.xcworkspace/xcuserdata/.xcuserdatad/UserInterfaceState.xcuserstate

And the errors go away!

I tried all of these (and many others) but none of them worked. After hours of trying various fixes, I found that the following procedure worked.

cd "project directory"
git add .

You will need to close XCode and reopen or future Commits may fail.

Hope this helps someone.

Xcode 8 seems to often miss git add the deleted/related files. To correct it, tap Commit... from Xcode's Source Control menu, make sure to check these files (which are followed by an exclamation mark !), then commit the changes. This should clear the warnings.

I have resolved this issue by following steps:

  1. Clear Derived Data

  2. Discard Missing files while commit and then do commit.

  3. Clean Build

  4. Resolved..

Happy Coding.. :)

I have faced the same problem after adding custom CollectionView cell(CustomCollectionViewCell) in the project.Same error occurred as above. No need to delete the file instead we can.

Rename Missing file for me it's "xCustomCollectionViewCell.xib" .

Now the error is gone.

Again rename the same file to original name "CustomCollectionViewCell.xib"

This fixed it for me:

git reset HEAD <path-to-deleted-file-that-was-causing-the-Xcode-warning>

I had this issue on Xcode 9.3

The solution that worked for me: Add a space in the file, save, then wait for the ! status to change to M, and delete the space, save.

Sadly, with nearly a 100 files to go through, I revisited this post, and this comment from @BennyTheNerd to an answer, helped!

For me, it was as easy as quickly disabling and then re-enabling source control under preferences. Xcode > Pref > Source Control > uncheck "enable source control" .... then re-enable it after. And poof! gone! – BennyTheNerd Jan 16 '17 at 7:29

Additionally though, I had quite Xcode and then open the same project, and then re-enable source control through preferences.

Hope this helps!