I just experimented and I see exactly the same thing. I think the problem is that the compiler will not scan the file unless it is imported into a file that is scanned.
If you import your protocol header into a .m
file and compile it for luck, you should start getting the autocomplete on NSString.
EDIT
It's clear from the comments on my answer and elsewhere that jazou2012 is under a misapprehension.
Autocomplete has nothing to say about whether a module is correct or not. Autocomplete may fail to find an identifier for several reasons, even if that identifier has been correctly defined. For instance, I was able to replicate Jazou's problem with NSString in a protocol even though Foundation.h
was imported.
However, as soon as I imported my protocol header into .m
file, the autocomplete started recognising NSString
. My guess is that autocomplete only starts indexing files if they are visible to the compiler.
If you want to catch compilation errors, you need to compile the code. If the compiler says "no errors or warnings", your code is OK regardless of what autocomplete says.