I'm very new to Xcode and Objective C, though I've been developing with Unity/C# for some time now. I'm having a hard time trying to get the autocompletion and syntax highlighting to work "properly" in Xcode 8.3. Over that last two days, I've been searching all over the internet and tried all the recommended solutions and workarounds that I found without any luck. So I decided to open a new question. Steps to reproduce my issue:
- In Xcode create new "Single View Application" project.
- Create a new class "TestClass".
- In TestClass.h try typing NSAr... Expected result: Xcode should suggest NSArray (because the Foundation.h was imported automatically). Actual result: it doesn't. no autocompletion
- Import UIKit.h to TestClass.h, and in TestClass.m try calling UIViewController methods. Expected result: Xcode should suggest UIViewController as typing, and then highlight the class name. Actual result: it does neither. no syntax highlighting
What I tried:
- Delete the DerivedData folder.
- Restart Xcode/computer (many times)
- Make sure the .m file is added to the target (in Target Membership window)
- Add the Foundation framework explicitly in Build Phases > Link Binary With Libraries
- Set the Framework Search Paths in Build Settings to the Frameworks folder
- Download the iOS and Xcode documentations in Preferences > Components
- Install Xcode 7.3.1 and 7.0, to see no difference.
I'm probably missing something basic here, but I think it's reasonable to expect such feature to work out-of-the-box, without much hassle?
Any help would be much appreciated!
UPDATE:
I also tried:
- Add $(SRCROOT)/ to Header Search Path.
- Increase log level: defaults write com.apple.dt.Xcode IDEIndexingClangInvocationLogLevel 3 and look for Xcode-specific "file not found" errors in the Console.app (no such errors found).
Also the test app is a very simple one with few lines of code and it builds fine. The only warning is the "unused variable" for the UIViewController *vc variable (2nd screenshot).