'sharedDispatcher'已弃用

use*_*582 16 iphone

我添加了这个功能.

- (void) registerWithTouchDispatcher {
    [[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];
}
Run Code Online (Sandbox Code Playgroud)

错误:sharedDispatcher已弃用

这是什么意思,我该怎么办?

the*_*aws 42

看一看ccDeprecated.h,它说使用:

[[CCDirector sharedDirector] touchDispatcher]


rob*_*dra 16

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

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