Xcode: issue "file xxx.png is missing from working copy" at project building

88,694

Solution 1

The warning will disappear as soon as you commit your changes (Xcode 8).

Solution 2

It seems that this problem may have different causes, but it's often in relation with source control software.

In my case, I solved it by going to Git, and adding the files again. I mean running the following command:

git add .

Solution 3

You can also disable source control by unchecking

Xcode -> Preferences -> Source Control -> Enable Source Control

if you're managing it via command line or any other app.

Solution 4

In XCode -> SoureControl:

Update + Refresh Status did it for me.

Solution 5

In my case, the file was missing from the source control.
To fix, I had to discard this file (be careful only discard the missing file not all your project):

  1. Xcode->Source Control->commit
  2. Right Click the missing file
  3. Choose Discard Changes
Share:
88,694
Iban
Author by

Iban

Updated on July 08, 2022

Comments

  • Iban
    Iban almost 2 years

    After deleting/adding some png files to project, i have got messages when building project.

    "file ProjectPath\aaa\xxx.png is missing from working copy."

    All these files are in the project, and the application is running. However, these messages are annoying. Looked .plist file, but there is no mention of these files. What should I do to remove these messages?

  • Iban
    Iban over 9 years
    Thanks, but they are not in the Build Phases, and cleaning build folder does not help too.
  • Android3000
    Android3000 about 8 years
    I'm thinking this may be due to images having "@" in the filename, such as the "@2x" and "@3x" convention. SVN uses that symbol for revision syntax (to escape it when working with SVN in the command line, you simply add an "@" at the end as the last occurrence is the one it uses to try and determine revision info). Simply running Update worked for me. When I added some new images, I actually had to manually select "add" on the 2x/3x variants in the File Inspector pane as well. Weird.
  • Chrissi
    Chrissi about 8 years
    Yes, this happens when you delete something from a project under version control when it is still referenced by version control (in my case, svn). Using "svn update" to restore the missing files, then deleting them the proper way using "svn delete", made the issue go away for me.
  • Warpzit
    Warpzit over 7 years
    This! so Important. The issue also comes if you rename a folder containing files. In other words, xcode gives us warnings because we haven't commited our code yet! clap clap clap
  • Chris Livdahl
    Chris Livdahl over 7 years
    Found that I just had to commit my changes under git after moving some files to a different directory.
  • Alexander Vasenin
    Alexander Vasenin over 7 years
    @LearnSwift Clean Cmd+Shift+K, delete ~/Library/Developer/Xcode/DerivedData/*?
  • Dan Ross
    Dan Ross over 7 years
    After installing Xcode 8 and upgrading the code to swift 3 I ended up with over 300 issues that needed syntax corrections (massive project). Instead, I restored from a backup and upgraded to swift 2.3 ... all went well except for a bunch of these 'missing' messages. This command worked like a charm - I'm back in business!
  • Learn Swift
    Learn Swift over 7 years
    @AlexanderVasenin neither
  • jaytrixz
    jaytrixz over 7 years
    This worked for me. I had to close Xcode and open the project again and run.
  • charmingToad
    charmingToad over 7 years
    For me simply staging changes was enough. Good to know.
  • Sebastian Sastre
    Sebastian Sastre over 7 years
    This is what worked for me. The issue started when I removed what I used to had in Pods in favor of Carthage
  • Shardon
    Shardon over 7 years
    This works for me too. It seems that the file is under source control and git needs to get updated also.
  • Blind Ninja
    Blind Ninja over 7 years
    @LearnSwift you are not alone my friend. I pushed my code twice but still have 92 warnings.
  • Carmen
    Carmen over 7 years
    after git commit the warning disappeared
  • tontonCD
    tontonCD over 7 years
    It works for me, I did remove the DerivedData folder, and warnings were for files as "db.xcindexdb"
  • Admin
    Admin over 7 years
    For others: you have to located in the root folder of your Xcode project with executing the 'git add .' command: /MyXcodeProjects/AwesomeApp/
  • Stefan
    Stefan over 7 years
    This worked for me, too. I had the issue after copying an existing project to make a derivative, but with cut down functionality ⇒ less source files.
  • samiq
    samiq over 7 years
    this did it for me, kind of annoying to see this in the IDE, they should either support source control well or none at all
  • EdwardM
    EdwardM over 7 years
    First, I made sure to Commit and Push my latest changes. Then I did Xcode > Source Control > Discard All Changes, and it cleaned up all the errors for me.
  • EdwardM
    EdwardM over 7 years
    As you mentioned, I did make sure to Commit and Push my latest changes. But doing just that did not remove the errors. So then I did Xcode > Source Control > Discard ALL Changes, and it cleaned up all the errors for me.
  • eric
    eric about 7 years
    correct answer... but the exact answer @emrekyv posted 3 months previous... He gets the vote up
  • George
    George about 7 years
    @eric he suggested just to disable source control, I showed how to make it work correctly.
  • vib
    vib about 7 years
    if you want a finer control git status will show you the files to add and then git add your_filename
  • MikeLondonUK
    MikeLondonUK about 7 years
    This latest commit worked for me. I had a particular issue when deleting .xcdatamodel files in .xcproject. Subsequent warnings in .xcworkspace disappeared (if of interest, see my original issue which was resolved by following this commit changes advice here: stackoverflow.com/questions/43403412/…)
  • Adam Smaka
    Adam Smaka about 7 years
    you also have to restart xcode after commiting changes. only then errors will disappear.
  • emresancaktar
    emresancaktar about 7 years
    when you commiting your files be sure to select all files to commit and problem should solve.
  • Shubham Naik
    Shubham Naik almost 7 years
    @EdwardM make sure you added all those file paths that are giving you the missing warning
  • nyxee
    nyxee almost 7 years
    Going to XCode -> Source Control -> Add xxx.xxx did the trick for me.
  • Viktor
    Viktor almost 7 years
    I have done two actions :1) "uncheck", 2) "check" for Enable Source Control. Warnings was disappeared.
  • Martin
    Martin almost 6 years
    What if the project does not use version control or a version control system not supported by XCode.
  • Martin
    Martin almost 6 years
    What if you don't use git?
  • Martin
    Martin almost 6 years
    I got the problem and I don't use version control XCode is aware of. All version control done outside XCode.
  • Martin
    Martin almost 6 years
    I don't use the version control inside XCode and sill got the problem.