The problem is that whatever arguments I pass to the instance method, the values xPos and yPos always seemed to be randomly assigned !
For example:

Code:

[[GriPosition alloc] initWithX:6 Y:6]

Gives me values like 1086324736 for xPos and yPos..

Debugging shows that the instance method is indeed called with these values above. But how is this possible ? I passed in 6 and 6 ! I remember stumbling over this very problem a few month ago, but it somehow resolved itself - unfortunately that's not the case this time

Ok, I cleaned the project and built it again, but no luck. Next I removed the GridPosition class from my project (deleting the header and source files) and started to re-implement the class: The problem stayed After that I renamed the instance method from

Code:

-(id)initWithX: (int)xtmp Y:(int)ytmp

to

Code:

-(id)initWithXPos: (int)xtmp YPos:(int)ytmp

And things seem to work properly now. But this is so strange, I wish I knew what the cause for this problem was (or is).

method declared somewhere else, and since -alloc returns id, the compiler choses whichever comes first in the module. If you included the right header files, you should at least have seen a compiler warning.

But I don't remember getting a compiler warning (if so I would have tracked down the problem, I'm sure)

But yeah, something must be getting mixed up during compilation.. I just can't pinpoint it. Next time the problem shows up, I will investigate further. For now I will just shrug it off and continue development..