I'm seeing a weird random error happening in my code. The 'unrecognized selector' error is being fired, but when I try to look for the code that's causing the error I can't find it.
For example, I get the error
-[Levels hide]: unrecognized selector sent to instance 0x81c600'
but there is no hide method in my class Levels and, more importantly, there is nowhere in code where I'm trying to call the hide method in Levels. When I debug the error using gdb the line actually calls an instance of [Sprite hide]; It's almost as if a pointer to an instance of Sprite is being overwritten by a pointer to Levels but again there's nothing in code which would cause this.
Is there anything which would cause this apparent corruption of my object pointers at runtime? I'm doing nothing fancy with pointers and it's not in any specific part of code that I can post, if I comment out where the error is happening on one run it'll happen somewhere else the next time I run. But if I run the same code twice it'll happen reliably in the same place.
I'm seeing a weird random error happening in my code. The 'unrecognized selector' error is being fired, but when I try to look for the code that's causing the error I can't find it.
For example, I get the error
-[Levels hide]: unrecognized selector sent to instance 0x81c600'
but there is no hide method in my class Levels and, more importantly, there is nowhere in code where I'm trying to call the hide method in Levels. When I debug the error using gdb the line actually calls an instance of [Sprite hide]; It's almost as if a pointer to an instance of Sprite is being overwritten by a pointer to Levels but again there's nothing in code which would cause this.
Is there anything which would cause this apparent corruption of my object pointers at runtime? I'm doing nothing fancy with pointers and it's not in any specific part of code that I can post, if I comment out where the error is happening on one run it'll happen somewhere else the next time I run. But if I run the same code twice it'll happen reliably in the same place.
Aargh!
Does Level inherit from Sprite or Sprite inherit from Level? Shooting in the dark...
-[Levels hide]: unrecognized selector sent to instance 0x81c600'
but there is no hide method in my class Levels and, more importantly, there is nowhere in code where I'm trying to call the hide method in Levels. When I debug the error using gdb the line actually calls an instance of [Sprite hide];
That's a classic symptom of an object that got over-released. You had a pointer to a Sprite, but you released it too many times (or it was autoreleased and you didn't retain it) and it was deallocated. That memory location was reused for the "Levels" object.
Take a look at the life cycle of your Sprite object, and figure out why it's getting released.