If I use this code, the app works:
if ([self.navigationController respondsToSelector:@selector(showUpdateRecordModalWithFrontWord:andBackWord:)]) {
NSLog(@"seems to respond");
[self.navigationController performSelector:@selector(showUpdateRecordModalWithFrontWord:andBackWord:)
withObject:[currentCard frontWord] withObject:[currentCard backWord]];
}
If I add a third parameter (below), I get a SIGABRT.
if ([self.navigationController respondsToSelector:@selector(showUpdateRecordModalWithFrontWord:andBackWord:andNotes:)]) {
NSLog(@"seems to respond");
[self.navigationController performSelector:@selector(showUpdateRecordModalWithFrontWord:andBackWord:andNotes:)
withObject:[currentCard frontWord] withObject:[currentCard backWord] withObject:[currentCard notes]];
}
The method is here:
- (id)showUpdateRecordModalWithFrontWord:(NSString *)arg_name1 andBackWord:(NSString *)arg_name2 andNotes:(NSString *)arg_name3 {
NSLog(@"%s", __FUNCTION__);
AppProductModalController *modal = [[AppProductModalController alloc] initWithNibName:nil bundle:nil];
[modal setNewRecord: NO];
[modal setDelegate: self.topViewController];
[modal.navBar.topItem setTitle: @"Update Card"];
[modal.frontWordField setText: arg_name1];
[modal.backWordField setText: arg_name2];
[modal.notesField setText: arg_name3];
[self presentModalViewController:modal animated:YES];
[modal release];
return nil;
}
Am I running into a limit of parameters, or am I just doing something wrong?
I appreciate any help..
NSObject only defines
performSelector:,performSelector:withObject:andperformSelector:withObject:withObject:. There’s no magic behind the scenes here where you’re “adding objects” — there just isn’t such a method asperformSelector:withObject:withObject:withObject:. Probably your best solution is to just send the message directly rather than going throughperformSelector:. The selector doesn’t vary, so it shouldn’t be a problem.