Xcode 7.3 autocomplete is so frustrating

狂风中的少年 提交于 2019-11-26 18:52:07

问题


There is a new autocomplete in Xcode. Probably might be useful because it checks not only beginning of names etc. But I found that very often it doesn't find a class name or a const name at all etc. I need to type in entire name by myself. Over all I found it makes my life harder and coding more time consuming. Is there a way to switch to the old way it used to work?


回答1:


Xcode 7.3.1

  1. In Xcode > Preferences > Text Editing

    uncheck Enable type-over completions

  2. restart Xcode




回答2:


It seems that clearing the checkbox "Enable type-over completions" in XCode -> Preferences -> Text Editing does the trick. At least in my case autocompletion fell back to a sort of old way, so it could autocomplete the class name that I had to type in manually before that.




回答3:


This is by no means an adequate solution, BUT it has allowed me to (barely) maintain my sanity the past few days: After every build, you need to trash your Derived Data folder. You can find this folder in Xcode > Preferences > Locations > Derived Data. Just trash the whole thing and it'll kick off a re-indexing step that should restore proper autocomplete functionality. Unfortunately, I've found that once I build, the autocomplete behavior reverts to its broken state.




回答4:


just open Xcode derived data folder and delete the folder

/Users/yourUserName/Library/Developer/Xcode/DerivedData

then restart Xcode, now autocompletion works like a charm




回答5:


I have the impression that some 'parts' of autocompletion simply fail after a while. I use to restart the Mac to get it back working. But sometimes it fails quite soon again. Maybe the answer of @Alex Bykov combined with a restart will do the trick.

Anyway: auto-completion of Xcode always was crap. AppCode used to get it much better. Unfortunately not yet with swift.




回答6:


Closed Xcode, opened Xcode, let it index, it worked.




回答7:


it doesn't find a class name

As a work-around, you can try to press Command + Shift + K and Command + B Several times,it works temporarily.




回答8:


Xcode 7.3.1

I will share another posible reason, that after couple of days we found out. We have multiple schemes, and in one of them, the bridging header was importing a file that didn't exist anymore. So, it didn't break while compiling and running (the header belongs to another scheme) but it caused the autocompletion to break (couldn't find any objective-c class).

Hope it would help someone!




回答9:


After having tried different methods:

  • Delete Derived Data
  • Switching Module Enabled off in Build Settings
  • Full Clean
  • Relaunch

Only this worked:

  • Find any commented out (/* abc */) code after @end in your files and delete.

Credit to Max_B: https://forums.developer.apple.com/thread/7439

In my case, other projects were auto-completing correctly. If all your projects fail to correctly predict code, then it might be a different issue, and the other answers might work.




回答10:


I ran into this issue while trying to make an OS X app and I was able to fix this issue by making sure that the Xcode 7.3 documentation and the OS X 10.11.4 documentation was actually downloaded. Doing this fully restored my autocomplete functionality. My full instructions are below as well as in my answer to a similar question: https://stackoverflow.com/a/39420664/3444925

I had this problem myself and after looking through all the other similar questions & answers about this, I couldn't find a solution. However, I finally found what worked for me.

Go to Xcode -> Preferences -> Components. There you will probably find a screen that looks like the following:

This shows that the documentation has not has not been downloaded and therefore, any attempts to re-index or re-build the application without downloading the documentation would prevent you from being able to use the autocompletion functionality.

Once I downloaded the Xcode 7.3 Documentation and the OSX 10.11.4 Documentation, this was enough for me to get the autocomplete functionality back (I was trying to build an OS X app, so feel free to download as much documentation as is relevant for you).




回答11:


I didn't run into this until I created a couple of new class files. Other classes worked fine, but autocomplete would NOT work for anything in the new files...

FIX (for me) - I had to add those files to ALL of my targets, including the unit test targets even though I wasn't using them yet.



来源:https://stackoverflow.com/questions/36169099/xcode-7-3-autocomplete-is-so-frustrating

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!