Connecting ViewController causes SpriteKit to terminate app - ios

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

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

App crashes when performing unwind

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

App crashes on iPad simulator

I am building a universal app. App is working fine for iPhone 5 and iPhone 4(different storyboard) but it crashes when trying to run it for iPad 6.1
This is the error:
-[AccountTableViewController topViewController]: unrecognized selector sent to instance 0xab52620
2013-08-19 21:13:35.527 [6871:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AccountTableViewController topViewController]: unrecognized selector sent to instance 0xab52620'
*** First throw call stack:
(0x2131012 0x1c26e7e 0x21bc4bd 0x2120bbc 0x212094e 0x2c1a 0xb68157 0xb68747 0xb6994b 0xb7acb5 0xb7bbeb 0xb6d698 0x2b10df9 0x2b10ad0 0x20a6bf5 0x20a6962 0x20d7bb6 0x20d6f44 0x20d6e1b 0xb6917a 0xb6affc 0x252d 0x2455)
libc++abi.dylib: terminate called throwing an exception
You are calling a UINavigationController method topViewController on a UITableView instance AccountTableViewController.
Without code, it's a little difficult to be more specific, but maybe you want to be calling this method on the UITableView's navigation controller?

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.

Table View in iOS Simulator

I'm with a little problem during the simulation in iOS Simulator.
I'm studying table view, and, when i start the simulator, the XCode shows the message:
2012-08-08 14:08:41.606 TableView[731:f803] -[UIViewController
tableView:numberOfRowsInSection:]: unrecognized selector sent to
instance 0x68cc530 2012-08-08 14:08:41.641 TableView[731:f803] *
Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '-[UIViewController
tableView:numberOfRowsInSection:]: unrecognized selector sent to
instance 0x68cc530'
First throw call stack:
(0x13c8022 0x1559cd6 0x13c9cbd 0x132eed0 0x132ecb2 0x1f006b 0x1f2862
0xa066d 0xa0167 0xa3134 0xa7623 0x50d42 0x13c9e42 0x1d80679 0x1d8a579
0x1d0f4f7 0x1d113f6 0x1d9e160 0x10e84 0x11767 0x20183 0x20c38 0x14634
0x12b2ef5 0x139c195 0x1300ff2 0x12ff8da 0x12fed84 0x12fec9b 0x10c65
0x12626 0x20a2 0x2015) terminate called throwing an exception(lldb)
I don't have any idea about how to fix it... Could someone help me?
You have to correctly implement the #required methods from UITableViewDatasource and UITableViewDelegate protocols.
It seems that you didn't implement tableView:numberOfRowsInSection:, which is one of these required methods.
-[UIViewController tableView:numberOfRowsInSection:]
In your error message, means that the table view's datasource is connected to an instance of UIViewController, which doesn't implement this method.
You have forgotten to change the custom class of your view controller to the appropriate class in the storyboard / xib file, so it is still a plain UIViewController. Change it to whatever your custom view controller class is using the identity inspector.

Resources