Skip to content

Posts tagged ‘XCode4’


Strange Debugger Issue with Local Variables

Update: tested against the latest XCode 4.2 build and it is still the case. So I reported a bug:

Apple Bug Report

Update: after I wrote and published this entry I realized that what I suspected might be right. So I made a breakpoint inside the constructor of the class in question: ProgramStepEntity and later when it is used as local variable. Now all the variable show up in the constructor (actual init method) as well as when it is used as local variable. Now I don’t want to have breakpoints in every constructor just to make sure that the debugger is working correctly. Need to check if that is still the same problem in 4.2 and if yes then I’ll fill a bug report.

Since a while I am bogged with a stupid debugger issue using XCode 4.0.2. So what gives:

In XCode4 you don’t have to declare your variables anymore if you declare them as properties (@property …). The compiler will take the info from the property definition and declare the variable. That works fine and the properties will show in the debugger when they are inside self or a member variable of self. So far so good.

But when I use the same class as a local variable the debugger is not showing that member. This is the code:

@interface ProgramStepEntity : BaseKVCMapper {
@property (nonatomic, retain) NSString* instruction;
@property (nonatomic, retain) NSArray* parameters;
@property (nonatomic, retain) NSString* target;

Missing Local Members

Here is another break point where the variable show up:

Same Class but with Variables

This can be fixed if I declare the variable:

@interface ProgramStepEntity : BaseKVCMapper {
    NSString* instruction;
@property (nonatomic, retain) NSString* instruction;
@property (nonatomic, retain) NSArray* parameters;
@property (nonatomic, retain) NSString* target;
Fix with Variable Declaration

Now sure what is wrong but I sometimes see all the variable will show up and sometimes they don’t. It could be that the debugger is storing the list of variable once and if at that time the list is incomplete it will not show the rest.

– Andy


Object-C Categories: Why and How

Did you ever wonder what an Object-C Category is good for and how to actually code and use one? Here is a short rundown of why I needed one and how I actually did it including using a property in my category which is per se not allowed within a Category.

Cheers – Andy