Xcode 9 Autocomplete Not Working 100% - Partially

2020-02-16 06:27发布

This morning, Xcode 9.0 (9A235) shows a new/strange Auto Complete box that is not at all what it used to be. How do I get the full auto-complete box so that autocomplete looks like how it usually does?

enter image description here

30条回答
▲ chillily
2楼-- · 2020-02-16 06:48
  1. check whether you selected the Suggest completions while typing in Xcode -> Preferences -> Text Editing
  2. navigate to user->Library->Developer->Xcode->DerivedData in Finder and delete the DerivedData folder
查看更多
迷人小祖宗
3楼-- · 2020-02-16 06:49

For me, the problem occured when I discarded all the changes of one file (under Source Control > Commit), which effectively deleted the file. This is what I wanted and I thought that the file and all references to it would be delted too.

However, there was still a reference to the file (shown in red) in the Project navigator. Deleting the (now non-existant) file in the Project navigator magically brought auto-completion back.

No amount of cleaning, deleting derived data, etc helped. I only realized the deleted file was still showing when I tried to build my project, which of course failed because it couldnt find that file.

Hope this will help someone save 30 minutes :)

查看更多
做自己的国王
4楼-- · 2020-02-16 06:49

If you have issue with weird completion/auto-completion/intellisense (not showing default stuff like delegates and datasource protocols methods) just change your target (e.g. from simulator iPhone 8 to real device), build the project and switch back to your original target.

Similar with issues with Interface Builder (storyboards) not showing anything, but only "nothing selected" whenever you select any part of the view. Just switch to other Xib/Storyboard (or even create new), check if it works there and switch back.

These workarounds worked for me in both cases (had both issues in one day with one project on Xcode 10.2.1). From what I've seen all over internet forums it seems these are bugs never fixed since Xcode 6.x or so.

Cheers!

查看更多
叼着烟拽天下
5楼-- · 2020-02-16 06:50

I added here what was going on in my project just in case it can help someone else... I had 2 files with the same name and I didn't realise.

查看更多
霸刀☆藐视天下
6楼-- · 2020-02-16 06:54

Removing the file from the Test Targets fixed my problem.

查看更多
我想做一个坏孩纸
7楼-- · 2020-02-16 06:57

I'm using Xcode 10.2 and I had the same issue.

This answer from axel helped me to fix.

Anyway, I'm going to describe a bit more:

  1. Go to YourProject.xcodeproj by clicking with Right Mouse Click and open Show Package Contents
  2. Go to xcuserdata and delete your youruser.xcuserdatad

If you have also the xcworkspace(if you already have any pods installed) then do step 3&4, if not then just skip step 3&4:

  1. Go to YourProject.xcworkspace by clicking with Right Mouse Click and open Show Package Contents
  2. Go to xcuserdata and delete your youruser.xcuserdatad

  3. Quit Xcode

  4. Delete Derived Data by using Terminal:

rm -rf ~/Library/Developer/Xcode/DerivedData

  1. Open Xcode and check if it works.

enter image description here

查看更多
登录 后发表回答