Hey guys, I have another problem. This time with NSNotificationCenter. Now it crashes, but a few days ago, when I added a notification, it worked correctly. Between me, I added code that has nothing to do with this ...
I have about 10x10 plates. Each fragment adds itself as an observer as soon as it is created:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerJumped) name:@"TestNot" object:nil];
And in my player class, every time the jump ends, I send a notification with the following code:
if (self.postNotifications == YES) {
If I use NSLog () in a tile, I see that 3 or 4 tiles receive a notification. And after that, the application crashes with EXC_BAD_ACCESS. It says objc_msgSend() selector name: playerJumped . But I donβt understand why. I see that it works with the first, than failure. What is my mistake here? Could you help me! Sandro
EDIT: is there a problem because the notification was received by about 100 objects?
source share