This bug is befuddling to me, but here goes:
I was trying to set up an IBAction to run on touch up inside on a UIButton. For some reason, it wasn't working, and wasn't really giving me any gdb errors. Every now and then it would mention an unrecognized selector. I checked to make sure my File's owner was the correct class, and everything was in check and it was, so I ran it again and still nothing.
I figured it might be a problem with Interface Builder, so I used addTarget: on the button, setting the target as self, and the selector the selector of the method I wanted to call, and still got an unrecognized selector error. To test that the selector did exist, I ran a [self performSelector:] on the selector of the method I wanted, and it worked. So basically right now I have this:
- (void)viewDidLoad {
[super viewDidLoad];
[self performSelector:#selector(hi)];
[_backButton addTarget:self action:#selector(hi) forControlEvents:UIControlEventTouchUpInside];
}
- (void)hi {
NSLog(#"HI");
}
The perform selector works perfectly, and logs "HI". Here's the kicker, when I touchup on _backButton, it gives me an unrecognized selector error, even though I just called it and it worked:
2011-10-22 19:54:40.824 VideoGif[396:707] -[NSKeyValueObservance hi]: unrecognized selector sent to instance 0x590690
2011-10-22 19:54:40.831 VideoGif[396:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSKeyValueObservance hi]: unrecognized selector sent to instance 0x590690'
I've taken screen shots of the nib and the implementation file, viewable here: http://imgur.com/a/q2a6N
Does anyone know what's going on?
The problem is probably happening because your instance of CaptionEditorViewController is being deallocated for some reason, as pointed by random classes throwing "unrecognized selector" exceptions
Related
I have an XIB that I present as a modal view. I have a button that calls the following -
(IBAction)dismissVC:(id)sender {
[self.parentViewController dismissModalViewControllerAnimated: YES];
}
When I press it the app crashes with this notice -
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ViewController dismissVC:]: unrecognized selector sent to instance 0x8379350'
The thing I noticed is that I have a ViewController.xib file and I have this MapView.xib that is a modal VC I want to dismiss. It's presented from a ViewController.xib
What could be the possible issue? I've hooked up all the actions and the File Onwer thing as well.
Thanks in advance!
Try this:
unrecognized selector sent to instance
that might be your solution.
I'm having this issue with cocos2d. Hopefully someone else has seen this before. The error message (in the title):
Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '+[NSInvocation
invocationWithMethodSignature:]: method signature argument cannot be
nil
keeps coming up when I'm trying to draw a scene. To get to it, you click a button on the main menu and it brings you directly to it. I've stepped into it and it crashes on the line where I'm trying to add some buttons:
CCMenuItem *menuItem1 = [CCMenuItemImage
itemFromNormalImage:#"menubtn-normal.png"
selectedImage:#"menubtn-pressed.png"
target:self
selector:#selector(displayMatchMaker:)];
When I use the method where "target: self selector:#selector(displayMatchMaker:)]" is not there, it works fine and draws the button. The displayMatchMaker: method DOES exist, in this same implementation. I'm beginning to lose my mind here! Hopefully someone can help me!
Here's the method implementation:
- (void)displayMatchMaker:(id)sender{
...
}
As it turns out, the code was in the wrong spot. It was crashing because it technically couldn't see the method, even though it was in the same implementation. Once I moved the code over to a new location, it worked fine.
If I remember correctly the selector should be without colon:
#selector(displayMatchMaker)
-(void) displayMatchMaker { }
I'm using Flurry to track stats of my iPhone app, and lately I've been seeing several REALLY weird errors. Seemingly random objects are receiving a "numberOfSectionsInTableView" message, and I have no idea how/why. The app was built using the 4.2.1 SDK and targeted for iOS 4.0 devices. Here is a snippet of some examples:
NSInvalidArgumentException: -[NSCFString numberOfSectionsInTableView:]: unrecognized selector sent to instance 0x4f3de10
NSInvalidArgumentException: -[__NSCFData numberOfSectionsInTableView:]: unrecognized selector sent to instance 0x4f55bc0
NSInvalidArgumentException: -[NSPathStore2 numberOfSectionsInTableView:]: unrecognized selector sent to instance 0x4f5ebc0
NSInvalidArgumentException: -[__NSCFType numberOfSectionsInTableView:]: unrecognized selector sent to instance 0x2ac5f0
NSInvalidArgumentException: -[PLPhoto numberOfSectionsInTableView:]: unrecognized selector sent to instance 0x2fbc30
NSInvalidArgumentException: -[PLPhotoLibrary numberOfSectionsInTableView:]: unrecognized selector sent to instance 0x725ea20
I'm only specifying numberOfSectionsInTableView in my usual UITableView delegate methods, not calling it directly. The only code I found that calls this method directly was in the ASIHTTPRequest library:
if (section == [self numberOfSectionsInTableView:aTableView]-1) {
return 30;
}
return 0;
But this was in "ASIAuthenticationDialog.m" and I'm not using auth with ASIHTTPRequest.
Has anyone seen anything like this before? I'm open to any and all suggestions, pretty stumped here, and unable to reproduce it so far.
Thanks.
Sounds like a classic over-release problem. You have over-released an object and some other random object is being messaged instead.
Turn on zombie detection and try your test case again.
I had same issue and my problem was that I created data source locally in method and it runs to same memory issue
- (void)setupDataSource {
/* some code to create sections */
TransactionDetailDataSource *dataSource = [[TransactionDetailDataSource alloc] initWithSections:sections];
self.tableView.dataSource = dataSource;
self.tableView.delegate = dataSource;
[self.tableView reloadData];
}
...So I had to create new property
#property (nonatomic, strong) TransactionDetailDataSource *dataSource;
and add this line
self.dataSource = dataSource;
at the end of method.
For some reason I cannot figure out I have an IBAction code wired up to fire on the touchupinside for a UIButton on a view using Interface Builder. Simple stuff right?? Well it works fine in my iphone version but for some reason I keep getting the following error when I click on the button in the iPad even though I have it wired up properly. IB has the the correct class name for files owner, it's wired to the action. I've checked and double checked my connections, rewired them from scratch, cleaned classes, deleted the app from the simulator and googled to the end of the internets.
Why would this be any different between ipad and iphone version? Can someone please help me before I go insane on something that should be working but just refuses to work???? Even weirder it seems whatever I try to wire up to an action is throwing a similar error. I'm starting to think Interface Builder is just crazy or something.
2010-08-15 14:19:13.372 AppName[28524:207] * -[UIViewController doClick]: unrecognized selector sent to instance 0x4d7fac0
2010-08-15 14:19:13.373 AppName[28524:207] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIViewController doClick]: unrecognized selector sent to instance 0x4d7fac0'
UIViewController doesn't respond to doClick: which is what you are seeing here.
In the nib file for your view, have you set the "File's Owner" to the class that you inherit from UIViewController and contains the doClick: method?
I have a Tab Bar application with four new headers, implementation and interface files, and added those as the sources in IB. They were in this format: FirstView.h/m/xib, SecondView.h/m/xib.
I then had files for First-, Second-, Third- and FourthView.
There was also a file there called FirstViewController. I did not touch this, I just deleted it because I wasn't going to need it.
I then laid out my interface for the first view (FirstView.h/m/xib) in IB. It had an image on the top, label under and a UITableView under that.
I sat up the correct connections (delegations and datasource for the tableview) in my FirstView.h/m file, and pressed Build. It seemed to build without errors, so I pressed Build and Go.
The Simulator popped up, installed the app and crashed. (Error message:Terminating app due to uncaught exception).
Complete error message:
2010-02-06 21:50:54.733 Mudo[52439:207] *** -[FirstViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x39101a0
2010-02-06 21:50:54.735 Mudo[52439:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[FirstViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x39101a0'
2010-02-06 21:50:54.736 Mudo[52439:207] Stack: (**LotsOfNumbers**)
I asked about this in another question, got an answer, and that fixed it:
It was obviously looking for code in the FirstViewController.h/m-file, although I did not do anything to make it look for code there.
I fixed this by adding two interfaces and implementations in my FirstView.h/m file. (FirstView and FirstViewController)
When I ran the app then, the table view and tab bar came up on the screen, but my image and label did NOT.
I don't have any idea of why it was looking for the code in FirstViewController instead of FirstView... I have the correct connections in IB, too..
A tableview is trying to query its data source for the number of rows it should display. If you've connected the tableview's datasource outlet to an instance of your FirstViewController class, then you need to implement -tableView:numberOfRowsInSection: in that class.