xcode 没有助理结果
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38314310/
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
No Assistant Results
提问by Ryan Cocuzzo
I am having an issue where the code associated with some of my View Controllers is not showing up in the Assistant Editor window to the right of the Storyboard. It says "No Assistant Results" where the swift code should be.
我遇到了一个问题,即与我的某些视图控制器关联的代码未显示在故事板右侧的“助理编辑器”窗口中。它在 swift 代码应该在的地方说“没有助手结果”。
Things I have tried (There are many things):
我尝试过的事情(有很多事情):
- Cleaning project
- Deleting DerivedData
- Creating new, identical View Controllers to see if the issue was just in those particular views.(the same issue occurred)
- Deleting and Reinstalling Xcode
- Restarting my Computer.
- 保洁工程
- 删除派生数据
- 创建新的、相同的视图控制器以查看问题是否仅出现在这些特定视图中。(发生了同样的问题)
- 删除和重新安装 Xcode
- 重新启动我的电脑。
NOTE: I also am getting a warning at the top of the editor: Internal Error has occurred, source Editor functionality is limited.
注意:我还在编辑器顶部收到警告:发生内部错误,源代码编辑器功能受限。
回答by Glenn
Ok, I've had this problem before. I didn't remember how I solved this so I searched on Google and found this question. But this time, nothing helped me. These are the things I did. I believe the last one solved this.
好的,我以前遇到过这个问题。我不记得我是如何解决这个问题的,所以我在谷歌上搜索并找到了这个问题。但这一次,没有任何帮助。这些是我做的事情。我相信最后一个解决了这个问题。
- Clear Derived Data. Go to Terminal and enter this:
rm -rf ~/Library/Developer/Xcode/DerivedData
- Quit the whole Xcode.
- Close all tabs of Xcode and make sure to view some class files instead of Interface builder and go try again viewing assistant results.
- Remove the assigned class to the View Controller nib you think causes the problem, then assign the class again. Boom! Solved!
- 清除派生数据。转到终端并输入:
rm -rf ~/Library/Developer/Xcode/DerivedData
- 退出整个 Xcode。
- 关闭 Xcode 的所有选项卡并确保查看一些类文件而不是 Interface builder 并再次尝试查看助手结果。
- 将分配的类删除到您认为导致问题的视图控制器笔尖,然后再次分配该类。繁荣!解决了!
回答by Arash HF
This method worked for me: (Xcode 10.2)
这种方法对我有用:(Xcode 10.2)
1- Select the broken ViewController on the StoryBoard
1- 在 StoryBoard 上选择损坏的 ViewController
2- In Identity Inspector, change the item in Classto another class (any class)
2- 在Identity Inspector 中,将Class 中的项目更改为另一个类(任何类)
3- Change the Classback to related class
3-将班级改回相关班级
4- Save and close the project
4- 保存并关闭项目
5- Reopen the project
5-重新打开项目
回答by Gary Z
I tried various ideas mentioned here but nothing worked for me. So in the Project navigator, I right clicked on the .DS_Store file, clicked on Delete, and then chose "Move to Trash" on the confirmation prompt. After closing Xcode and opening it again, a new .DS_Store file was created. The Assistant Editor is working again and the .h and .m files appear in the Project navigator again. I am using Visual Studio for Mac which communicates with Xcode. Today I had to close and open both Visual Studio and Xcode after deleting the .DS_Store file.
我尝试了这里提到的各种想法,但没有任何效果对我有用。所以在项目导航器中,我右键单击 .DS_Store 文件,单击删除,然后在确认提示中选择“移至垃圾箱”。关闭 Xcode 并再次打开后,会创建一个新的 .DS_Store 文件。助理编辑器再次工作,.h 和 .m 文件再次出现在项目导航器中。我正在使用与 Xcode 通信的 Visual Studio for Mac。今天,我不得不在删除 .DS_Store 文件后关闭并打开 Visual Studio 和 Xcode。
回答by Ale Ravasio
I don't know if this is still helpful or not, for what is worth, the way I managed to restore this when it's been working perfectly and all of a sudden it stopped is by changing Assistant Editor
view-mode.
我不知道这是否仍然有帮助,对于什么是值得的,我设法在它完美运行并且突然停止时恢复它的Assistant Editor
方式是通过更改视图模式。
I usually have it in Assistant Editors at bottom
, so just change it to whatever else, such as All Editors Stacked Vertically
and go back, and it should be working ok now.
我通常将它放在 中Assistant Editors at bottom
,因此只需将其更改为其他任何内容,例如All Editors Stacked Vertically
并返回,现在应该可以正常工作了。
xcode 8.3.2, if it's any use.
xcode 8.3.2,如果有任何用处。
回答by Chris Birch
Argh!This annoyance happens to me all the time.
啊!这种烦恼一直发生在我身上。
I'm not 100% sure I know what the fix is, however I think I may have just "fixed" this a few seconds ago using the following voodoo:
我不是 100% 确定我知道修复是什么,但是我想我可能只是在几秒钟前使用以下伏都教“修复”了这个:
1) Delete derived Data
1) 删除派生数据
2) Close xcode, reopen Xcode. Maybe Wait for indexing to finish?
2)关闭xcode,重新打开Xcode。也许等待索引完成?
3) View a source code file (.m,.h, .swift) in the main editor, the assistant editor should now show "Counterparts".
3) 在主编辑器中查看源代码文件(.m、.h、.swift),助理编辑器现在应该显示“Counterparts”。
4) Change this to "Manual" rather than "Automatic"
4)将其更改为“手动”而不是“自动”
5) Switch back to your nib/storyboard
5)切换回你的笔尖/故事板
6) Change back to "Automatic" rather than "Manual"
6) 改回“自动”而不是“手动”
7) Probably continue pulling hair out :)
7)可能会继续拔头发:)
Edit
编辑
Seems as though maybe only step 3 is required as this happened again just now.
似乎可能只需要第 3 步,因为刚才又发生了这种情况。
回答by Arnett Bellamy
I had this issue and was able to resolve it. I resolved it by viewing the storyboard as source. I then removed everything in and including the tags (Saving it to restore later). I then went back and viewed the storyboard normally and created a new ViewController. Once the new ViewController was on the storyboard the assistant editor acted as normal. I then went back and viewed the storyboard as source code once again and replaced the current tags with the one I removed previously. This resolved my issues hopefully it will help for you.
我遇到了这个问题并且能够解决它。我通过查看故事板作为源来解决它。然后我删除了包括标签在内的所有内容(保存以便稍后恢复)。然后我返回并正常查看故事板并创建了一个新的 ViewController。一旦新的 ViewController 出现在故事板上,助理编辑器就会正常工作。然后我返回并再次将故事板作为源代码查看,并用我之前删除的标签替换了当前标签。这解决了我的问题,希望对您有所帮助。
回答by user1994956
For me (Xcode 11) it was cause by installing cocoapods, tried all the trick that I could find. Finally this helped me. Go to Xcode File Menu -> WorkSpace Settings -> enable legacy build systems
对我(Xcode 11)来说,这是由于安装 cocoapods 造成的,我尝试了我能找到的所有技巧。最后这对我有帮助。转到 Xcode File Menu -> WorkSpace Settings -> enable legacy build systems
回答by Ricardo Montesinos
I had the same problem and I realized that selecting the Outletsoption in the top of the Assistant EditorView solves the problem.
我遇到了同样的问题,我意识到选择Assistant EditorView顶部的Outlets选项可以解决这个问题。
In addition to this, I found that if your classes are in several groups for some reason Xcode losses the reference to the class.
除此之外,我发现如果您的类由于某种原因在几个组中,Xcode 会丢失对类的引用。
回答by Carmelito R. Bayarcal Jr.
Deleting derived data did not work for my problem. This is how I solved this when I encountered this issue,
删除派生数据对我的问题不起作用。当我遇到这个问题时,我是这样解决的,
Go to the file that contains your class, go to File inspector > Target Membership, and then make sure that there is a check mark in the target of your project.
转到包含您的类的文件,转到文件检查器 > 目标成员资格,然后确保项目的目标中有复选标记。
I hope this solves your issue.
我希望这能解决您的问题。
回答by sweet-2
In my case, the class name of File's Owner is incorrect (the class doesn't exist). I corrected the class name and it works again
就我而言,文件所有者的类名不正确(该类不存在)。我更正了班级名称,它再次起作用