ios Xcode 8 - 丢失文件警告

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39711061/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 10:21:56  来源:igfitidea点击:

Xcode 8 - Missing Files warnings

ioscocoapodsxcode8

提问by Alan

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.

自从使用 Swift 2.3 升级到 Xcode 8 以来,我有几个丢失文件的警告。它们都与我正在使用的豆荚有关。

The files that are missing are

丢失的文件是

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

The pods that are showing missing files are

显示丢失文件的 pod 是

  • Realm (~38 of 43)
  • TextFieldEffects (~3 of 43)
  • BEMCheckBox (2 of 43)
  • 领域(约 38 个,共 43 个)
  • TextFieldEffects(约 3 个,共 43 个)
  • BEMCheckBox(43 个中的 2 个)

How do I fix this issue?

我该如何解决这个问题?

回答by matt

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 gitcommit and the current state of things and reports these warnings. They go away as soon as you do a git addthat includes the file deletion / rename.

这只是一个 Xcode 错误。如果您删除或重命名文件而没有进行提交,Xcode 会看到前一次git提交与当前状态之间的差异并报告这些警告。只要您执行git add包括文件删除/重命名的操作,它们就会消失。

回答by milczi

If you dont use xcode source control but some other git client (like source tree or terminal), you can disable source control in Xcode and than warnings will disappear.

如果您不使用 xcode 源代码控制,而是使用其他一些 git 客户端(如源代码树或终端),您可以在 Xcode 中禁用源代码控制,这样警告就会消失。

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

Xcode > Preferences > Source control 并取消选中“ Enable source control

回答by Parrett Apps

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.

您将需要关闭 XCode 并重新打开,否则未来的提交可能会失败。

Hope this helps someone.

希望这可以帮助某人。

回答by hassan karimi

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

  1. 将罪魁祸首添加到项目中 在此处输入图片说明

  2. 删除引用 在此处输入图片说明

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

这会清除 XCode 的内部状态并且消息消失。

回答by Rahul Joshi

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

您可以通过选中X-Code->Preferences->Source Control 中的“自动添加和删除文件”选项来解决此问题

Here is the screenshot of Preferences

这是首选项的屏幕截图

回答by Tim

How about commitin Source Control.

怎么样commitSource Control

You may firstly have to show Packet Contents of "your project name".xcodeprojand show Packet Contents of project.xcworkspaceand then delete the xcuserdatafolder.

您可能需要先显示 Packet Contents"your project name".xcodeproj并显示 Packet Contents,project.xcworkspace然后删除xcuserdata文件夹。

If you still cannot commit because of Couldn't communicate with a helper applicationproblem 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.

*记得重新打开工程看看效果。

回答by CodeBrew

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

Xcode 8 似乎经常错过git add已删除/相关的文件。要更正它,请Commit...从 Xcode 的Source Control菜单中点击,确保检查这些文件(后跟感叹号!),然后提交更改。这应该清除警告。

回答by Patrik Forsberg

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)

正如有人已经提出的,它与版本控制有关,是的,也不是,在某些情况下,它肯定与直接使用查找器或其他任何东西(但不是来自 XCode)查看文件有关

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

这里有一个快速修复,可以节省很多麻烦和脏话!

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

删除此文件:./.xcworkspace/xcuserdata/.xcuserdatad/UserInterfaceState.xcuserstate

And the errors go away!

错误消失了!

回答by freytag

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.

我有同样的问题。就我而言,我的项目的父目录中有一个 .git 目录。通过删除该父 .git 目录,错误消失了。

回答by Pawe?

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 :

在我的情况下,Pods 签入存储库生成几百个“丢失文件”警告。通过从 repo 中删除 Pod 来修复它:

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