简体   繁体   English

Swift Xcode中的文件有问号(?)

[英]Swift files in Xcode have Question Mark (?)

I am working with Xcode for 3 months now.我现在和 Xcode 一起工作了 3 个月。 This has happened to me twice.这发生在我身上两次。

Xcode deleted my ViewController.swift file twice. Xcode 删除了我的ViewController.swift文件两次。 I couldn't find it in the bin.我在垃圾箱里找不到它。 I dont know whats wrong with that.我不知道那有什么问题。

App was working nice then I commit my code.应用程序运行良好,然后我提交了我的代码。 After that, Xcode gives me compile error:之后,Xcode 给我编译错误:

File "myController.swift" not found找不到文件“myController.swift”

Xcode showing "?" Xcode 显示“?” at front of my swift file:在我的 swift 文件前面:

在此处输入图像描述

The question mark means that the file is not under version control, it doesn't mean that it has been deleted.问号表示该文件不受版本控制,并不意味着它已被删除。 You can use the command git add -A to add all files in the directory to your version control.您可以使用命令git add -A将目录中的所有文件添加到您的版本控制中。 This SO question lists all the Xcode version control symbols, here they are. 这个 SO 问题列出了所有 Xcode 版本控制符号,它们在这里。

U: Working file was updated U:工作文件已更新

G: Changes on the repo were automatically merged into the working copy G:回购上的更改自动合并到工作副本中

M: Working copy is modified M:工作副本被修改

C: This file conflicts with the version in the repo C:此文件与repo中的版本冲突

?: This file is not under version control ?: 这个文件不受版本控制

:: This file is under version control but is missing or incomplete :: 此文件受版本控制但丢失或不完整

A: This file will be added to version control (after commit) A:这个文件将被添加到版本控制(提交后)

A+: This file will be moved (after commit) A+:该文件将被移动(提交后)

D: This file will be deleted (after commit) D:这个文件将被删除(提交后)

S: This signifies that the file or directory has been switched from the path of the rest of the working copy (using svn switch) to a branch S: 这表示文件或目录已经从工作副本的rest路径(使用svn切换)切换到一个分支

I: Ignored我:无视

X: External definition X:外部定义

~: Type changed ~: 类型改变

R: Item has been replaced in your working copy. R:您的工作副本中的项目已被替换。 This means the file was scheduled for deletion, and then a new file with the same name was scheduled for addition in its place.这意味着该文件被安排删除,然后一个同名的新文件被安排添加到它的位置。

L: Item is locked L:项目已锁定

E: Item existed, as it would have been created, by an svn update. E:项目存在,因为它会被 svn 更新创建。

This could be due to the git/source tree when your code is under version control.当您的代码处于版本控制之下时,这可能是由于 git/source 树。 when you import files to your project and this will not be added in git.当您将文件导入到您的项目时,这将不会添加到 git 中。

To fix this:要解决此问题:

right-click on the '?'右键单击“?” file and select source control then at the bottom click Add Selected Files .文件和 select 源代码管理,然后在底部单击Add Selected Files This should fix.这应该修复。 在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM