ios - unrecognized selector sent to class. 'calling methods in ClientViewController.mm' -


i trying call method in clientviewcontroller.mm class , keep getting error: terminating app due uncaught exception

'nsinvalidargumentexception', reason: '+ [clientviewcontroller testmethod]:   unrecognized selector sent class  

i have class implements interface.

void applerecognitionstatusobserver::onrecognitionstatuschanged                                        (recognitionstatus newstatus) {     switch(newstatus) {         case kinprogress:             [clientviewcontroller testmethod];             break;         ....etc     } } 

how can call clientviewcontroller methods c++ class?

client view controller.h

//imports uikit etc @interface clientviewcontroller : uiviewcontroller <avaudiorecorderdelegate>{     iboutlet uibutton *recobutton;     // other buttons } @end  // , .mm //#imports.... @interface clientviewcontroller () @end @implementation clientviewcontroller -(void)testmethod{     outlabel.text = @"has been called!"; } 

you should make sure clientviewcontroller.m has method implementation testmethod so:

+(void)testmethod {     // code here } 

your clientviewcontroller.h should have matching header declaration so:

+(void)testmethod; 

if need instance method, instead of class method make sure change + - so:

-(void)testmethod {     // code here } 

and

-(void)testmethod; 

Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -