amt amt - 4 months ago 14x
Objective-C Question

cannot call static method from MainViewController from CDVPlugin class objective c and phonegap

I need to call static method from MainViewController to add Progress Bar, this progress bar show downloading progress from connection object in CDVPlugin class.

I make static method in MainViewController like:

+ (void)CommonMethod

and defined it in MainViewController.h too like:

+ (void)CommonMethod;

I want to call it in class which is inherited from CDVPlugin, it's a bridge with javascript side.

I call it by two ways:

MainViewController *mainView = [[MainViewController alloc] init];
[mainView CommonMathod];


[MainViewController CommonMathod];

But, the two was result this warning which stop all of my app completely.

instance method '-CommonMethod' not found (return type defaults to 'id')

What can I do ?

Thank you in advance,


Try this..

[[MainViewController class] CommonMethod];

it is helpful