App crashes when performing unwind - ios

What I'm trying to perform
A programmatic unwind from Screen C back to Screen A (normally A->B->C)
What I've done
I've created the function - (IBAction)unwindToScreenA:(UIStoryboardSegue *)unwindSegue {
in Screen A's .m and its definition in .h file.
I've created an manual unwind in Screen C by CTRL-Dragging from Owner Icon to Escape Icon (unwind segue exists, but not tied to any button)
I've given the unwind a name, and then in the code I perform [self performSegueWithIdentifier:#"unwindFromCtoA" sender:self];
In other words, I think I've strictly done what's needed for this task. I did have it working before, but something else I changed must have broken it, and I can't trace the error.
The error I have
2014-02-06 13:28:28.899 PrototypeApp2[2885:60b] -[DMSScreenCViewController tag]: unrecognized selector sent to instance 0x14e7ff60
2014-02-06 13:28:28.902 PrototypeApp2[2885:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '-[DMSScreenCViewController tag]: unrecognized selector sent to instance 0x14e7ff60'
*** First throw call stack:
(0x2ddf7f4b 0x382386af 0x2ddfb8e7 0x2ddfa1cb 0x2dd494d8 0xc966d 0x30ae6d63 0xca34f 0x30782dcd 0x30782c15 0x306878bb
0x3073af7b 0x305eafb9 0x305631f3 0x2ddc31cd 0x2ddc0b71 0x2ddc0eb3 0x2dd2bc27 0x2dd2ba0b 0x32a52283 0x305cf049 0xc80a5 0x38740ab7)
libc++abi.dylib: terminating with uncaught exception of type NSException
UPDATE
Changing
[self performSegueWithIdentifier:#"unwindFromCtoA" sender:self];
to
[self performSegueWithIdentifier:#"unwindFromCtoA" sender:Nil];
fixed it. Any ideas why?

The issue happened when you try to call tag property on your DMSScreenCViewController object.
This is a UIViewController subclass and there is no tag property so you cannot call it.
Maybe you try to call tag on your destination or source view controller in your segue method which is reference to DMSScreenCViewController object.

DMSScreenCViewController Check that this is the expected class as I suspect it's not.
You may have to update a storyboard

Related

Terminating app due to uncaught exception 'NSInvalidArgumentException' , reason: '-[NSNull _fastCStringContents:]: unrecognized selector

I created a new tabbed application in Xcode. I am receiving the following error every time I try to type any letters or numbers into a text field.
I noticed that this error started when I checked the box for "is initial view controller"
When i have the ViewController itself set as the initial ViewController it will not throw the error. However, when I make a NavigationController the initial ViewController it will throw this error.
Error received:
Reminder[46707:4165261] -[NSNull _fastCStringContents:]: unrecognized selector sent to instance 0x10d087af0
2016-03-23 00:48:19.830 Cable tech Reminder[46707:4165261] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull _fastCStringContents:]: unrecognized selector sent to instance 0x10d087af0'
For me this issue was caused because I inadvertently clicked on the Key Commands controls in the attribute inspector. I did not create any commands, but having and empty entry caused any input into a textField to crash.
Solution :-
1) Right click on storyboard and open as source code.
2) Search for keyCommands and delete that empty keyCommands tag.
3) Clean and Run.
This solved my problem, I hope it will be helpful for you as well.
Cheers

Connecting ViewController causes SpriteKit to terminate app

I have a SpriteKit game, but now I'm working on making a menu. I decided to try to make these menus in a normal way, using Storyboards and UIViewControllers.
However, this is proving to be very difficult.
I added a new UIViewController, and set it as the initial viewcontroller. This causes no problems. However, as soon as I hook this up to a completely basic UIViewController file (FirstMenuViewController.m), with no edits or additions, ViewController.m seems to freeze up at if(!skView.scene){.
I'm getting this error:
-[UIView scene]: unrecognized selector sent to instance 0x170164980
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView scene]: unrecognized selector sent to instance 0x170164980'
*** First throw call stack:
(0x187f7f100 0x1944881fc 0x187f83db4 0x187f81ae0 0x187ea178c 0x1001012ec 0x18af42f90
....
libc++abi.dylib: terminating with uncaught exception of type NSException
What I don't get is why ViewController.m is even called, as there is no connection to that file from my FirstMenuViewController which is set as the initial viewcontroller.
Could someone please explain to me what is going on here?
Turns out I was subclassing the ViewController supplied by the SpriteKit-template instead of UIViewController when creating my FirstMenuViewController

When clicking a cell, my app throws a NSInternalInconsistencyException

I am kind of a novice to programming and I thought I could find help here.
I am trying to make an app where when you click on the table view cell, it shows more detailed information. When you click the cell, the debug area opens up and I am given the following message:
2013-07-15 12:41:19.261 Chevy[3909:c07] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "ToB-mL-k5t-view-Ref-qb-iy9" nib but didn't get a UITableView.'
* First throw call stack:
(0x1c99012 0x10d6e7e 0x1c98deb 0x24a357 0xfbff8 0xfc232 0xfc4da 0x1138e5 0x1139cb 0x113c76 0x113d71 0x11489b 0x114e93 0x8ef23f7 0x114a88 0x470e63 0x462b99 0x462c14 0xca249 0xca4ed 0xad45b3 0x1c58376 0x1c57e06 0x1c3fa82 0x1c3ef44 0x1c3ee1b 0x1bf37e3 0x1bf3668 0x1affc 0x212d 0x2055)
libc++abi.dylib: terminate called throwing an exception
Does anyone know what I am doing wrong? I can post some of my code if you'd like.
The IBOutlet is either disconnected in the xib file for the tableView or connected to some unwanted element.

iOS Button Target Actions with Block Crashes

I'm implementing UIButtons with block actions set on them for connivence and speed of integration. I've used this method before, a while ago now, and had little issue with it. Now, however, i'm facing an issue where integrating...
https://gist.github.com/2468899
... into my app now crashes it on launch. The error i'm receiving is as follows...
2012-09-27 22:18:47.459 flink[12174:907] -[UIButton setAction:withBlock:]: unrecognized selector sent to instance 0x1e8ae610
2012-09-27 22:18:47.460 flink[12174:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIButton setAction:withBlock:]: unrecognized selector sent to instance 0x1e8ae610'
*** First throw call stack:
(0x3885a3e7 0x333bf963 0x3885df31 0x3885c64d 0x387b4208 0xea477 0xff6af 0x36b92cb1 0x3882f8f7 0x3882f15d 0x3882df2f 0x387a123d 0x387a10c9 0x3868c33b 0x34014289 0xe7b8f 0xe7b30)
libc++abi.dylib: terminate called throwing an exception
... i've never seen this issue before but it's odd that it is immediately crashing without any interaction.
Thanks in advanced.
You must make sure to add the implementation file of the category to your target. In Xcode, go to the File Inspector and make sure the Target Membership checkbox for your target is checked.

Objective-c program crashes when trying to remove objects from superview

Bellow is the code i am calling when i press a button. The button will call the method bellow. But i get a "unrecognized selector sent to instance" error. What am i doing wrong? The objects have been declared in another method before this one is called. I have also tried hiding the buttons but they also crash. Someone please help.
-(void) clearControlPannel{
[buttCheck removeFromSuperview];
[buttBet removeFromSuperview];
[buttCall removeFromSuperview];
[buttRaise removeFromSuperview];
[buttFold removeFromSuperview];
[betLabel removeFromSuperview];
[betSlider removeFromSuperview];
}
The crash is:
Thread 1: EXC_BAD_ACCESS" on the [buttCheck removeFromSuper]; line
-[__NSCFDictionary removeFromSuperview]: unrecognized selector sent to instance 0x686b020 2012-06-24 19:08:12.175
HeadsUp[59630:f803] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary removeFromSuperview]: unrecognized selector sent to instance 0x686b020'
unrecognized selector sent to instance
error is due to the fact that the runtime is not able to find the method that will respond to that specific action. In other words, it's not able to map the name of your method (the selector) with its implementation.
So, if you have a method that accept no parameter like yours
- (void) clearControlPannel {...}
the selector will be only clearControlPannel.
Otherwise, if you have specified a parameter for that method (e.g. like the sender, the UIButton in this case) like
- (void) clearControlPannel:(id)sender {...}
the selector would be clearControlPannel:. Pay attention to :.
If you provide more details we could help you.
EDIT
Just for pointing you in the right direction.
If you have used – addTarget:action:forControlEvents: on a UIButton instance you have to check two things.
First, did you set up the target correctly? The target is the object to which the action will be redirected.
Second, did you set up the right selector for that action?
Here an example:
[myButton addTarget:self action#selector(mySelector:) ...];
where
- (void)mySelector:(id)sender {...}
If the class where you have implemented that button will also respond to that action use self, otherwise you need to inject some other instance that will respond for that action.
Check wheather you are releasing the button which you are pressing.

Resources