iphone - Objective C - CCCallFuncND correct passing of an argument -
i've been trying call function below.it seems whenever in function playnote i'm trying access object i'm passing argument (mynum) crashes. i'm new , don't understand how pass parameters through cccallfuncnd. comments appreciated.
this call passes argument mynum:
id action2 = [cccallfuncnd actionwithtarget:self selector:@selector(playnote:data:) data:(nsnumber *)mynum];
this whole block:
- (void)muteandplaynote:(nsinteger)notevalue :(cclayer*)currentlayer { mynum = [nsnumber numberwithinteger:notevalue]; nslog(@"test number: %d", [mynum integervalue]); id action1 = [cccallfunc actionwithtarget:self selector:@selector(muteaudioinput)]; id action2 = [cccallfuncnd actionwithtarget:self selector:@selector(playnote:data:) data:(nsnumber *)mynum]; id action3 = [ccdelaytime actionwithduration:3]; id action4 = [cccallfunc actionwithtarget:self selector:@selector(unmuteaudioinput)]; [currentlayer runaction: [ccsequence actions:action1, action2, action3, action4, nil]]; }
nslog never displays crashes @ line.
- (void) playnote:(id)sender data:(nsnumber *)midinotevalue { nslog(@"test number 2: %d", [midinotevalue integervalue]); int myint = [midinotevalue floatvalue]; [pdbase sendfloat: 55 toreceiver:@"midinote"]; [pdbase sendbangtoreceiver:@"trigger"]; }
your method signature is:
-(void)playnote:(id)sender data:(nsnumber*)midinotevalue
but should be:
-(void)playnote:(id)sender data:(void*)data
this defined in ccactioninstant.h as:
typedef void (*cc_callback_nd)(id, sel, id, void *);
also i'm pretty sure information crash, call stack end console output, helpful paste here in case i'm wrong ;)
Comments
Post a Comment