我试图在我的ClientViewController.mm类中调用一个方法并不断收到此错误:由于未捕获的异常而终止应用程序
'NSInvalidArgumentException', reason: '+ [ClientViewController TestMethod]:
unrecognized selector sent to class
我有另一个实现接口的类。
void AppleRecognitionStatusObserver::onRecognitionStatusChanged
(RecognitionStatus newStatus) {
switch(newStatus) {
case kInProgress:
[ClientViewController TestMethod];
break;
....etc
}
}
如何从另一个 C++ 类调用ClientViewController方法?
客户端视图控制器.h
//imports UIKit etc
@interface ClientViewController : UIViewController <AVAudioRecorderDelegate>{
IBOutlet UIButton *recoButton;
// some other buttons
}
@end
// and the .mm
//#imports....
@interface ClientViewController ()
@end
@implementation ClientViewController
-(void)TestMethod{
outLabel.text = @"Has been called!";
}