Well, I’m creating a custom SEL like:
NSArray *tableArray = [NSArray arrayWithObjects:@"aaa", @"bbb", nil];
for ( NSString *table in tableArray ){
SEL customSelector = NSSelectorFromString([NSString stringWithFormat:@"abcWith%@", table]);
[self performSelector:customSelector withObject:0];
}
I got a error:
Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[Sync aaaWithaaa]: unrecognized selector sent to instance
but if i run it with the real method name it works!
[self performSelector:@selector(aaaWithaaa:) withObject:0];
How to solve it out?
You’ve already created selector from string – pass it to performSelector: method:
Edit: Mind, that if your method takes parameter then you must use colon when create selector from it: