I'm using Action Sheet Picket. I added .h and .m files as instructed in readme, picker and even cancelAction
is working well but somehow successAction
throws NSInvalidArgumentException
with this message: "unrecognized selector sent to instance".
Application is a kind of tab bar application with Navigation Controller
. There is a TabBarController
as root and there are ViewController
s which are located under the TabBarController
and one of the ViewControllers is a Navigation Controller. But I'm not getting this error in Navigation Controller. I'm not sure if this causes any error.
Here how I used:
- (IBAction)filterResult:(id)sender {
[ActionSheetStringPicker showPickerWithTitle:@"Pick Filter" rows:self.filterList initialSelection: self.selectedIndexes target:self successAction:@selector(animalWasSelected:element:) cancelAction:nil origin: self];
}
- (void)animalWasSelected:(NSNumber *)selectedIndex element:(id)element {
self.selectedIndexes = [selectedIndex intValue];
NSLog(@"Selected");
}
Yes that's all. I've already included ActionSheetPicker.h
file and as I said picker is working fine.
Finally here is error:
[MYYViewController successAction:]: unrecognized selector sent to instance 0x9032400
2012-12-24 12:14:45.488 Example[54268:11303] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MYYViewController successAction:]: unrecognized selector sent to instance 0x9032400'
Any help would be great.
Looks rather straight forward, you need to implement successAction:
in your MYYViewController
class, because the picker is not checking if it will respond or not and calling it directly.