开发者

Objective-C NSMethodSignature issue!

开发者 https://www.devze.com 2023-02-10 23:02 出处:网络
Basically I\'m using \"instanceMethodSignatureForSelector\" as part of the construction of an NSTimer. My problem is that the below NSMethodSignature is always set to \"Nil\".

Basically I'm using "instanceMethodSignatureForSelector" as part of the construction of an NSTimer. My problem is that the below NSMethodSignature is always set to "Nil".

NSMethodSignature *s开发者_开发百科ignature = [[self class] instanceMethodSignatureForSelector:@selector(gravityMeth:sprite:)];

The selector that it's looking at is the below.

-(void) gravityMeth:(CCSprite*)sprite:(b2Body*)body

Does anyone have any help because I honestly can't see the problem at all!

Thanks in advance!


-(void) gravityMeth:(CCSprite*)sprite:(b2Body*)body

That selector is gravityMeth::, not gravityMeth:sprite:.

Try:

 -(void) gravityMeth:(CCSprite*)sprite body:(b2Body*)body

Which would yield a selector of gravityMeth:body: (which would be somewhat more descriptive -- better still would be something like applyGravitySprite:withBody:).

0

精彩评论

暂无评论...
验证码 换一张
取 消