Hi,
I have a button in a view which refuses to work. I've got in working in a blank, default view application from X-Code, but in none of my applications will it work, instead it gives me the following error.
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[UIViewController showVicInfo:]: unrecognized selector sent to instance 0x3c084f0'
The debugger isn't any help either. I've made sure that I hook up the button to the file's owner (not the other way around) as well. Below is the code for the action. And I know it's not the alert view, because the breakpoint doesn't even reach there.
about.h
@interface about : UIViewController {
}
-(IBAction)showVicInfo:(id)sender;
about.m
-(IBAction)showVicInfo:(id)sender {
UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"No Internet Connection" message:@"You require an internet connection via WiFi or cellular network for iFirelert to work." delegate:self cancelButtonTitle:@"OK, thanks" otherButtonTitles:nil];
[myAlert show];
[myAlert release];
}
Update: FYI this is how I went about creating the button,if it helps.
- Created new view (File>New File>UIViewControllerSubclass w/XIB for interface)
- Added -(IBAction)showInfo:(id)sender; to about.h
- Added
- -(IBAction)showVicInfo:(id)sender { UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"No Internet Connection" message:@"You require an internet connection via WiFi or cellular network for iFirelert to work." delegate:self cancelButtonTitle:@"OK, thanks" otherButtonTitles:nil]; [myAlert show]; [myAlert release]; } to about.m
- Opened About.xib in Interface Builder, dragged a Rectangular Button onto the View
- Hooked up the button to the -showVicInfo action by ctrl-clicking the button to the File's Owner property (not the other way around).
- Checked the File's Owner was set to "about" class which it is.
And then built and run with failure in X-Code.
Update 2: OK, I've worked out it must be a setting or something in my existing project.I've copied the two class files and XIB file which does work in another X-Code project, but the button also throws the same error in the existing app.