Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IOS Method Calling

I have a method which i need to call within another method. in a UIViewController

//This is how i call methoed
tmpUITextView.text= [self ssidValue:1 arrayOf:ssidArray];


//my Method 
+ (NSString *)ssidValue:(NSInteger)selectedValue arrayOf:(NSMutableArray *)tmpArray {

    NSString *result=[tmpArray objectAtIndex:selectedValue];
    NSLog(@"%@",result);
    return result;
}

but i am getting waring ( warning: 'UIViewController' may not respond to '-ssidValue:arrayOf:')and crash it.

Please tell me what i am doing wrong here.

Thanks in Advance

like image 752
Shashi Avatar asked Dec 03 '22 07:12

Shashi


1 Answers

You are declaring the method as a class method (note the "+") but you are calling it as an instance method.

To solve this, either declare it as an instance method (replace "+" with "-") or call it as a class method:

[[self class] ssidValue:1 arrayOf:ssidArray];
like image 66
albertamg Avatar answered Jan 15 '23 13:01

albertamg