1

My code here(METHOD DEFINITION)

- (void)info:(NSString *)idno info1:(NSString *)package info2:(NSString *)rate info3:(NSString *)type info4:(NSString *)status;
{
  //CODE HERE
}

My code here(METHOD CALLING)

[self performSelector:@selector(info:info1: info2:info3:info4:) withObject:@"a" withObject:@"b" withObject:@"c" withObject:@"d" withObject:@"e"  ];

MY app displays the fallowing error:

No visible @interface for 'ViewController' declares the selector 'performSelector:withObject:withObject:withObject:withObject:withObject:'

Please help how to solve this problem

2 Answers2

3

you can directly called the method as like instead of performSelector

[self info:@"a" info1:@"b" info2:@"c" info3:@"d" info4:@"e" ];

else if you want to continue your work with the help of performselector see this already answered in SO

Anbu.Karthik
  • 82,064
  • 23
  • 174
  • 143
2

This is how you have to do.

in viewDidLoad

// create a dict 

NSDictionary *myDict = [[NSDictionary alloc] initWithObjectsAndKeys: @"my_pack" , @"package" , @"my_rate" , @"rate" ,  @"my_type", @"type" , @"my_status", @"status" , nil];

// Call your func

[self passMyValueHere:myDict];

your func

- (void) passMyValueHere : (NSDictionary *) myValues{

}
dahiya_boy
  • 9,298
  • 1
  • 30
  • 51
  • directly call [self info:pass your argments]; – Anbu.Karthik Apr 10 '18 at 06:50
  • @MohamedAli What is the issue?? Calling a func with multiple params or storing values into DB?? – dahiya_boy Apr 10 '18 at 06:53
  • both I want Calling a func with multiple params and when my function gets these value must store values into sqlite DB my inserting code here: NSString *strsave = [[NSString alloc]initWithFormat:@"insert into internet_rate values('%@','%@','%@' ,'%@' ,'%@')",idno ,package , rate,status ,type]; dboperation *ds = [[dboperation alloc]init]; BOOL st = [ds getalluser:strsave]; if (st) { NSLog(@"data is save"); } else { NSLog(@"data is not save"); } – Mohamed Ali Apr 10 '18 at 06:58
  • @MohamedAli Its a different ques, so better if you post new ques bcz here the quest is how to pass five values. – dahiya_boy Apr 10 '18 at 07:01
  • It's much easier to create an `NSDictionary` using literals: `NSDictionary *myDict = @{@"my_pack" : @"package" , @"my_rate" : @"rate"};` – koen Apr 10 '18 at 14:09