I had this method that I was calling and everything was fine:
DataHandler:
.h:
-(void)saveNumberOfTries:(NSString*)numberOfTries toWord:(NSString *)indexOfWord;
.m:
-(void)saveNumberOfTries:(NSString*)numberOfTries toWord:(NSString *)indexOfWord {...}
ViewController.m
DataHandler *dataHandler = [[DataHandler alloc] init];
[dataHandler performSelector:@selector(saveNumberOfTries:toWord:) withObject:numberOfTries withObject:wordId];
..I then updated it to take one more argument:
DataHandler:
.h:
-(void)saveNumberOfTries:(NSString*)numberOfTries toWord:(NSString *)indexOfWord currentLevel:(NSString*)userSelectedLevel;
.m:
-(void)saveNumberOfTries:(NSString*)numberOfTries toWord:(NSString *)indexOfWord currentLevel:(NSString*)userSelectedLevel {...}
ViewController.m:
DataHandler *dataHandler = [[DataHandler alloc] init];
[dataHandler performSelector:@selector(saveNumberOfTries:toWord:currentLevel:) withObject:numberOfTries withObject:wordId withObject:selectedLevel];
But the compiler is now giving me “Receiver type ‘DataHandler’ for instance message does not declare a method with selector ‘performSelector:withObject:withObject:withObject:'”.
If I put in the original method call (without changing anything in the DataHandler) it doesn’t give me any warnings although the method no longer exists. It seems Xcode isn’t keeping up with my changes. Any ideas or suggestions?
Because there is no method like
performSelector:withObject:withObject:withObject:You can compress into
NSArrayorNSDictionaryand then useperformSelector:withObject:withObject:Like in your case-
Other way if you don’t want to change definition of method, you can try like below then it will work fine –