Xcode 9 Autocomplete Not Working 100% - Partially Working
Xcode 9 Autocomplete Not Working 100% - Partially Working
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?
Probably it is because indexing hasn't been completed yet.
– ozgur
Sep 30 '17 at 18:19
11 Answers
11
Deleting the DERIVED DATA folder seemed to fix my issue. Thanks to this post: swift println() not showing autocomplete options while writting code
Clean didn't help. Only deleting a folder.
– Nik Kov
Oct 10 '17 at 21:47
This helped after restart. Thanks.
– user3739902
Dec 20 '17 at 10:45
Try:
that was the only way worked for me, thanks!
– Burning
Mar 11 at 8:06
Thanks, this worked for me
– Harsh Thakur
Mar 19 at 8:03
Only solution that worked for me.
– John K
Mar 28 at 18:00
awesome solution. so weird. I wonder how did you replicate this.
– Kunal Gupta
May 11 at 10:38
Million dollar answer. This even fixed 'Jump to Definition".
– OutOnAWeekend
May 14 at 14:49
Things to try:
1
Run this command in the project directory if you use cocoapods:
rm -rf ~/Library/Caches/CocoaPods;
rm -rf Pods; rm -rf ~/Library/Developer/Xcode/DerivedData/*;
pod deintegrate; pod setup; pod install;
2
Clean Cached Data
Clean the Project -> Cmd+Shift+K
Clean the Build Folder -> Cmd+Shift+Option+K
If you skipped step one:
Delete Derived DataXcode Preferences
-> Locations
->
Arrow Symbol Takes you to DerrivedData
-> Delete Folder
Xcode Preferences
Locations
DerrivedData
3
Check your Build Phase's Compile Sources.
Every .swift
and .m
file in the project should be in this list or it won't autocomplete in those files.
.swift
.m
4
Optimize your Editor:
Use fileprivate on every class property and function that you can to reduce the scope of the Compilers work per item.
Write modular/OOP code so you have less code for the compiler to read.
Avoid using Type Inferance when the result is a complex calculation, and try to break down complex calculations into let this = smallerOperation
statements
let this = smallerOperation
With XCode 9.2 there isn't an Arrow Symbol anymore to the Derived Data Folder. Thanks for the fileprivate tip. The nightmare continues...
– Sal
Jan 2 at 15:05
I still see the arrow symbol. Was this in an earlier version of 9.2 or something?
– Sethmr
Jan 18 at 17:39
Step 3 will solve auto completion
– akr ios
Mar 9 at 8:53
This can happen when the file is not a member of the Target. Open the file where autocomplete is not working and show the the "Utilities" tab in the top right of Xcode (blue in the screenshot below).
Ensure your Target (typically your app's name) is checked. Autocomplete should work almost instantly without restarting Xcode, cleaning, or deleting Derived Data.
worked for me ..thanks
– r3dm4n
Feb 24 at 14:56
only opening that page and closing worked. I'm confused. Thanks btw.
– pandaren codemaster
Mar 10 at 6:08
Removing the file from the Test Targets fixed my problem.
It could be because of many reasons, one among is that due to "Memory issue" i.e., when your system runs out of memory it would happen. You can check your memory usage using "Activity monitor" in mac.
Try cleaning the project with [command + shift + k]
Quit the XCode and launch it again & build it once then start typing now the autocomplete should be working fine.
Nope. Did all that & does not work :( Still same issue. 64GB Physical Memory, only 24 GB being used. Thoughts/ideas?!?!?!
– Ernie
Sep 30 '17 at 17:14
Seems like it is definitely this ONE PROJECT, all of a sudden this morning. It was ok last night. My other projects are ok. What can I do to fix anything in THIS PROJECT? Thoughts?
– Ernie
Sep 30 '17 at 17:27
@Ernie: 64GB superb! then sure it shouldn't be memory problem, If it happens for all the projects then it should have been "Suggest completion while typing" option in the XCode->Preference->Text Editing. But you said its only for one project !!!! So the question continues, Sorry I will let you know if I found some before anyone else solves your question.
– Bharath
Sep 30 '17 at 17:54
Just lost a day trying to solve the autocomplete nightmare of Xcode (9.2). Deleting derived data seemed to work briefly then things reverted. Reboots etc and other suggested voodoo failed to make a difference.
I gave up and download the 30 day trial of AppCode from Jet Brains. Autocomplete worked fine there and this maybe coincidence but it then started working again in my project in Xcode. Can't guarantee that it'll keep working...
"other suggested voodoo" lol - so well put... we loose so much time finding work arounds for apple's bugs, but I stopped complaining about xcode when I started using Android studio
– JohnV
Jun 21 at 10:55
Please try doing this:
Select the file >> check if the file is added to UITesting or UnitTesting targets (File inspector -> Target Membership). If so, please uncheck those two and make sure only the project target is selected. Then build and try if autocomplete is working fine.
This worked for me. Hope it help someone.
For me it was happening in my test file, because it wasn't part of a target for some reason. Setting it's target membership solved the issue.
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 :)
See my answer for the reason why.
– James Bush
Jun 28 at 20:19
Kooky answers.
The only time auto-complete doesn’t work is when the source code type for the file is not set to Objective-C or when you’re writing in another language (even if only a little snippet of, say, C).
It also doesn’t work if there is a syntax error on or above the line you are editing. A missing curly brace at the end of a method call—even if it’s not in the file you’re editing–will prevent auto-complete from obtaining the necessary context to suggest relevant commands. So will a missing file (shown in red in your list of files), even if that’s not the file you’re working on.
When it does that, attempt a build to locate errors, and then fix them.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Deleting the DERIVED DATA Folder solved it for me. Thanks to another post. Thanks to this post: stackoverflow.com/questions/28429630/…
– Ernie
Sep 30 '17 at 17:38