views:

397

answers:

3

I've been seeing this for well over a year and I can't figure out if it's a bug or I'm doing something wrong.

When I declare a property in one of my classes like

@property (nonatomic, retain) NSString *aString;

And I go to use this somewhere else like

myObject.aStr[ESC]

When the list pops down with all the suggestions, aString is always of type int. All of my properties are like this.

I've tried this on different installations, on different machines, releases or betas.

Anyone else seeing this? Or am I missing something?

+2  A: 

This is probably because that in some circumstances, undefined types in C are treated as int and Xcode doesn't have a background compiler (like Visual Studio does for C#) for its 'intellisense'.

If you compile your project right after declaring the property, Xcode should see the correct type.

Jason
+1  A: 

Perhaps XCode is picking up on the fact that what you have is not a string, it's a pointer to a string. There is no reason why it should think that it's an int, but maybe the fact that pointer are 4 bytes and ints are also 4 bytes causes this to happen. Building probably fixes this problem. I'll update when I get back to my mac.

TahoeWolverine
To follow up, I tried the use case in xcode, and had no problems.
TahoeWolverine
+3  A: 

This is a known bug in Xcode 3.1.x. The version of Xcode in the Snow Leopard release has many fixes to autocompletion behavior.

cdespinosa