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

StackOverflow https://stackoverflow.com/questions/20841316

  •  22-09-2022
  •  | 
  •  

Pergunta

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: 1-

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

OR 2-

[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,

Foi útil?

Solução

Try this..

[[MainViewController class] CommonMethod];

it is helpful

Outras dicas

Need

#improt "MainViewController.h"

And call with

[MainViewController CommonMathod];
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top