Xcode 代码感知和 cmd+单击符号不适用于我的其中一个项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10306539/
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
Xcode code sense and cmd+click to symbol doesn't work for 1 of my projects
提问by rob1302
I've been using Xcode 4.3.1 since it came out now and i've worked on many different projects since. Everything has always worked fine until this 1 new project i'm working on.
自从 Xcode 4.3.1 发布以来,我一直在使用它,从那时起我就从事过许多不同的项目。在我正在进行的 1 个新项目之前,一切都很好。
The code completion/code sense never finds anything or when i 'Command+Click' a variable or class normally it would jump to that but now i'm just getting 'Symbol Not Found'.
代码完成/代码感觉永远不会找到任何东西,或者当我“命令+单击”一个变量或类时,它通常会跳到那个位置,但现在我只是得到“找不到符号”。
If I open one of my older project while this bad one is open, the old ones still work for code sense and the new one doesn't.
如果我打开我的旧项目之一而这个糟糕的项目正在打开,旧项目仍然适用于代码意识,而新项目则不行。
My partner is working on the same project, we both get the files from our repository and the code sense works on his machine for this project...just not mine.
我的合作伙伴正在从事同一个项目,我们都从我们的存储库中获取文件,并且代码意识在他的机器上为这个项目工作……只是不是我的。
So i'm a little confused as to how to fix this..any ideas?!
所以我对如何解决这个问题有点困惑..有什么想法吗?!
Thanks!
谢谢!
回答by g_low
Try this:
尝试这个:
Open the organizer. Close your project in Xcode (leaving Xcode and the organizer running). In the organizer, in projects, click on the Delete button next to Derived Data. Quit Xcode.
打开组织者。在 Xcode 中关闭您的项目(让 Xcode 和管理器运行)。在管理器中的项目中,单击派生数据旁边的删除按钮。退出 Xcode。
Find your Xcode project via the finder. Rightclick and "Show Package Contents". Delete project.xcworkspace and xcuserdata folder.
通过查找器找到您的 Xcode 项目。右键单击并“显示包内容”。删除 project.xcworkspace 和 xcuserdata 文件夹。
Open up Xcode again and see if that works for you.
再次打开 Xcode,看看它是否适合你。
回答by Jorge Casariego
With Xcode 8.2 I solved in this way:
使用 Xcode 8.2 我以这种方式解决了:
- File > Workspace Settings
- Click over the little grey arrow above Advanced... Button (Derived Data)
- Select my project folder and delete it.
- 文件 > 工作区设置
- 单击高级...按钮(派生数据)上方的灰色小箭头
- 选择我的项目文件夹并将其删除。
Now in your project see if cmd+click works
现在在您的项目中查看 cmd+click 是否有效
回答by Luca Davanzo
In my case I solved in this way.
在我的情况下,我是这样解决的。
- Go to Project's propreties from Project navigator.
- Build Phases
- Add your *.mfiles in "Compile Sources"
- 从项目导航器转到项目的属性。
- 构建阶段
- 在“编译源”中添加您的*.m文件
Now re-build.
现在重新构建。
This could be happen, for instance, when your manually rename a class after its creations.
例如,当您在创建类后手动重命名类时,可能会发生这种情况。
Hope this help.
希望这有帮助。
回答by Naishta
Similar issues with XCode 8. Just quitting the XCode and Simulator, reopening the project worked. Other times, Restarting the mac gets rid of question mark and does navigate to relevant method implementations
与 XCode 8 类似的问题。只需退出 XCode 和模拟器,重新打开项目即可。其他时候,重新启动 mac 摆脱问号并导航到相关的方法实现
And at times, simply closing the project and opening it again from 'File -> Open Recent' also works (XCode 8 and Swift 3)
有时,只需关闭项目并从“文件-> 打开最近”再次打开它也可以(XCode 8 和 Swift 3)
回答by iPhoneDeveloper
For others if none of the above mentioned methods worked try this :
对于其他人,如果上述方法均无效,请尝试以下操作:
Go to menu bar Xcode - > Preferences -> Locations -> Command Line Tools
转到菜单栏 Xcode -> Preferences -> Locations -> Command Line Tools
Choose proper (current) Xcode format here.
在此处选择正确的(当前)Xcode 格式。
回答by MHCsk
Xcode 10.2.1- simply closing Xcode entirely and reopening it solved it for me.
Xcode 10.2.1- 只需完全关闭 Xcode 并重新打开它就为我解决了。
回答by Sachindra Pandey
3 reasons this happens :
发生这种情况的 3 个原因:
Corrupt derived data : Solution : clean derived data folder.
Corrupt project settings : Project.xcodeproject -> Right Click and clean the files mentioned in g_low's answer.
File not a part of project target : Check if the file is a part of compile source and if not add it...
损坏的派生数据:解决方案:清理派生数据文件夹。
损坏的项目设置:Project.xcodeproject -> 右键单击并清理g_low 的回答中提到的文件。
文件不是项目目标的一部分:检查文件是否是编译源的一部分,如果不是,则添加它...
回答by Honey
I had this problem, restarted, quit Xcode, nothing happened. Switched to master branch, pulled, checkout into new branch. Problem Gone. I even went back to my previous branch and all was working. My only guess is that git messes up sometimes!
我遇到了这个问题,重新启动,退出 Xcode,什么也没发生。切换到主分支,拉取,结帐到新分支。问题消失了。我什至回到我以前的分支,一切都在工作。我唯一的猜测是 git 有时会搞砸!
回答by Alex
In my case, .m
file was somehow located in en.lproj
directory and that prevented it from being shown properly with syntax coloring and intellisense on.
在我的情况下,.m
文件以某种方式位于en.lproj
目录中,这阻止了它在打开语法着色和智能感知的情况下正确显示。
In the File inspector
side panel check if there is something checked in Localization
tab.
在File inspector
侧面板中检查是否在Localization
选项卡中检查了某些内容。