Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'sharedDispatcher' is deprecated

Tags:

iphone

I've added this function.

- (void) registerWithTouchDispatcher {
    [[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];
}

error: sharedDispatcher is deprecated

what does it mean and what shall I do?

like image 548
user1401582 Avatar asked May 17 '12 17:05

user1401582


3 Answers

Take a look at ccDeprecated.h, it says to use:

[[CCDirector sharedDirector] touchDispatcher]

like image 196
thelaws Avatar answered Nov 14 '22 03:11

thelaws


Change: [[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];

To: [[[CCDirector sharedDirector] touchDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];

like image 16
robbycandra Avatar answered Nov 14 '22 04:11

robbycandra


You can check the Cocos2D code behind any Cocos (CC) method by pressing 'Shift+Command' keys and hovering on the method. Doing so on any deprecated method will take you to CCDeprecated.m which will also give you the new method.

like image 3
appVenture Avatar answered Nov 14 '22 03:11

appVenture