App crashes with [sender tag] - objective-c

I have a button within interface builder that has a '0' tag on it. The button has a method linked to it called -(IBAction) doTest:(id)sender.
I have the doTest method within my .m file as shown below:
-(IBAction) doTest:(id)sender
{
int currentSelection= [sender tag];
if (currentSelection == 0)
{
// do something
}
}
However my app crashes with the following error message and I have no idea why. Any help would be appreciated. Thanks.
[groceryapp doTest]: unrecognized selector sent to instance 0xc29c00
2012-03-04 20:26:10.155 groceries[4627:707] ***
Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '-[grocery doTest]: unrecognized selector sent to instance 0xc29c00'

Wrong message.
doTest vs doTest:

Related

Unrecognized selector sent to instance IOS 10

I have a very difficult problem when I launched my app on IOS10.3.3.. Indeed, I got this error in my splashviewController :
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
// [[EMAnalyticsManager sharedInstance]sendScreenViewWithName:SplashScreen];
}
I got this crash message:
[__NSCFString nsli_lowerAttribute:intoExpression:withCoefficient:forConstraint:]: unrecognized selector sent to instance 0x165e3630
2018-09-06 16:57:31.456059+0100 **********[2461:1072580] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString nsli_lowerAttribute:intoExpression:withCoefficient:forConstraint:]: unrecognized selector sent to instance 0x165e3630'
I made many research to understand the cause of this crash that didn't occur in IOS11.
Any help please??
Some constraints might be causing this when the very first view controller is loaded. Please check your constraint and you can also remove the constraints and then verify if it works.

"Unknown Class <MyClass> in my Interface builder error" but I don't have a MyClass

Here is the error I am receiving
2013-07-30 22:20:53.227 Matchismo[562:c07] Unknown class PlayingCardCollection in Interface Builder file.
2013-07-30 22:20:53.229 Matchismo[562:c07] -[UIView setSuit:]: unrecognized selector sent to instance 0x71433f0
2013-07-30 22:20:53.230 Matchismo[562:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setSuit:]: unrecognized selector sent to instance 0x71433f0'
I don't have a class called "PlayingCardCollection" so I don't see how I could be receiving this error unless I named something wrong but I cannot find an error like that.
Here is some of my code
- (Deck *) createDeck
{
return [[PlayingCardDeck alloc] init];
}
- (NSUInteger) startingCardCount
{
return 20;
}
- (void)updateCell:(UICollectionViewCell *) cell usingCard:(Card *) card
{
if ([cell isKindOfClass:[PlayingCardCollectionViewCell class]]) {
PlayingCardView* playingCardView = ((PlayingCardCollectionViewCell *)cell).playingCardView;
if ([card isKindOfClass:[PlayingCard class]]) {
PlayingCard *playingCard = (PlayingCard *)card;
playingCardView.rank = playingCard.rank;
playingCardView.suit = playingCard.suit;
playingCardView.faceUp = playingCard.faceUp;
playingCardView.alpha = playingCard.isUnplayable ? 0.3 : 1.0;
}
}
}
And this is part of another file.
- (NSInteger) numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
return 1;
}
- (NSInteger) collectionView:(UICollectionView *)collectionView
numberOfItemsInSection:(NSInteger)section
{
return self.startingCardCount;
}
- (UICollectionViewCell *) collectionView:(UICollectionView *)collectionView
cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell* cell = [collectionView dequeueReusableCellWithReuseIdentifier:#"PlayingCard" forIndexPath:indexPath];
Card* card = [self.game cardAtIndex:indexPath.item];
[self updateCell:cell usingCard:card];
return cell;
}
If anymore code is needed let me know. I have alot of files for this project but most weren't touched since my project had its last successful run. Thanks in advance!
Here's why your app is terminating:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setSuit:]: unrecognized selector sent to instance 0x71433f0'
Looking more carefully at the reason, notice that it says:
'-[UIView setSuit:]: unrecognized selector sent to instance 0x71433f0'
The message is telling you that your app tried to send a setSuit: message to an instance of UIView. The UIView class doesn't declare a setSuit: method or a suit property, so ordinarily this won't work.
The problem may or may not be related to the first issue, where it looks as though you set the identity of an object (possibly a view) in a nib file to a class that you later deleted or renamed. Look at the identities of the objects in the nib file (using the Identity Inspector tab), and see if you can find PlayingCardCollection.
If so change it to something more appropriate. Chances are, that's the indirect cause of the runtime exception.
The error says it all.The class name set to some view in interface builder as PlayingCardCollection and the class does not exist
To find out one best option is to select the nib and right click on it, open it as source code where it shows the xml structure representation of your nib
Then search for PlayingCardCollection and find it.Find the nib with that content and you can find the view from that nib ,More study on the nib itself can sort out the view easily

KTPhotoBrowser push to KTTumbsViewController

I am trying to use KTPhotoBrowser to use its thumbnail view capabilities. I have some difficulties to push to the viewController that was derived from KTThumbsViewController. It seems the navigationController can only push to UIViewController:
- (void)showSDWebImageSample
{
KTThumbsViewController *newController = [[KTThumbsViewController alloc] init];
[self.navigationController pushViewController:newController animated:YES];
}
and the header file for KTThumbsViewController includes:
#interface KTThumbsViewController : UIViewController <KTThumbsViewDataSource>
I grabbed the code from the provided sample. But it gives me the following runtime error:
-[KTThumbsViewController copyWithZone:]: unrecognized selector sent to instance 0x8877130
2012-10-30 14:52:03.004 myCases_MD[36941:c07] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[KTThumbsViewController copyWithZone:]: unrecognized selector sent to instance 0x8877130'
Could anyone help me please?
Cheers,

program crashes when trying to present modal view controller

I want to load another xib, and use this simple code:
AddElementViewController *viewToLoad = [[AddElementViewController alloc] initWithNibName:#"AddElementViewController" bundle:nil];
viewToLoad.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:viewToLoad animated:YES];
for some reason it throws me out with this output:
2012-03-11 11:56:57.990 Weesh[14650:11603] -[MainViewController AddPressed:]: unrecognized selector sent to instance 0x7b55b40
2012-03-11 11:56:57.991 Weesh[14650:11603] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MainViewController AddPressed:]: unrecognized selector sent to instance 0x7b55b40'
*** First throw call stack:
(0x13da052 0x198ed0a 0x13dbced 0x1340f00 0x1340ce2 0x13dbec9 0x32a5c2 0x32a55a 0x3cfb76 0x3d003f 0x3cf2fe 0x34fa30 0x34fc56 0x336384 0x329aa9 0x22c7fa9 0x13ae1c5 0x1313022 0x131190a 0x1310db4 0x1310ccb 0x22c6879 0x22c693e 0x327a9b 0x1cad 0x1c15)
terminate called throwing an exception(lldb)
do you have any idea what can cause it?
Somewhere in your code (it seems to be in AddElementViewController implementation) you are sending message AddPressed: to object of class MainViewController.
The call stack and crash error says that there are no method AddPressed: in class MainViewController.
Try to find all places where you are calling AddPressed: (first of all check loadView, viewDidLoad, viewWillAppear, viewDidAppear, init of AddElementViewController class) and check the type of receiver.

Exception: unrecognized selector ... when trying to push a view controller on Navigation stack

I am trying to push a view controller on the navigation stack with following code in my buttonPressed method
-(IBAction) viewButtonPressed:(id)sender {
PersonDetailViewController *personDetailViewController = [[PersonDetailViewController alloc] initWithNibName:#"PersonDetailViewController" bundle:nil];
[self.navigationController pushViewController:personDetailViewController animated:YES];
[personDetailViewController release];
}
I ran the debugger and it throws the exception after followin line is stepped over from above code.
[self.navigationController pushViewController:personDetailViewController animated:YES];
This is pretty standard call ... it has worked many times before without any problems. Any idea what am I missing here?
I am stuck at this point and not able to drill down further.
Here are the error messages on the console after running the debugger
2009-10-30 18:15:11.127 Untitled[6089:20b] * -[NSCFString image]: unrecognized selector sent to instance 0x3050
2009-10-30 18:15:11.129 Untitled[6089:20b] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFString image]: unrecognized selector sent to instance 0x3050'
2009-10-30 18:15:11.130 Untitled[6089:20b] Stack: (
807902715,
2460638779 ...
The problem was in one of the init methods where I was setting the back button item incorrectly.
I would start by looking inside the view lifecycle methods - viewWillAppear, viewDidAppear etc. - in the PersonDetailViewController class for invocations of a method named image on some object instance.
You can also try stepping through these methods in an attempt to narrow down where this invocation is made.