In my project I have a ContentViewController class which initially used an xib for layout. However, I later decided to delete the xib and programatically insert the subviews. When I deleted one of the subviews that had initially been present, I got:
"Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key infoView.'"
From research I know that this sort of error is almost always due to linkage issues between a class and a xib. I already checked to make sure that no class in the workspace references infoView, so that's not the issue. How can I unlink ContentViewController from the xib when the xib no longer exists? Thanks in advance!
Sometimes there are issues with the NIB file being deleted from inside the app, the safe way to resolve is to implement loadView and do your custom view creation there as this will prevent the superclass from trying to load a NIB.
Related
I have a strange problem with my segue, which is causing my app to crash. The app crashes in ListViewController.m at line 33:
dvc.menu = [self.blogPosts objectAtIndex:[[self.tableView indexPathForSelectedRow] row]];
With the following error:
menu[15782:c07] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<DetailViewController 0x7576d50> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key textView.'*
I have been researching for a very long time now, and it seems that many experience the same problem, although their solutions doesn't seem to work for me. This is a whole new world for me, and I'd really like to know, what exactly I am doing wrong.
I have uploaded the XCode project for you to look at, if it is to any help. Download project files here
Thanks in advance!
In your storyboard, your detail text view should be linked with a property named textView inside your detail controller header file.
In the header file, however, you have a contentView property (not textView).
So, you have to delete the textView link from your storyboard (right click on the text view and click on the X button on the referencing outlet) and link the text view with the correct outlet (contentView)
Could not download your project. If variable "dvc" is a instance of DetailViewController, you need to check if "menu" has get/set or not.
When testing in the iOS6 simulator, I am getting the following error when clicking a disclosure indicator:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] was unable to load a nib named "LocationDetail"'
It runs perfectly fine in iOS5.
I do NOT have the LocationDetail nib anymore, nor need to use it. I have looked in my entire project for references to it, as well as in my MainWindow nib and all connections looking to see where it could be used, but I find none.
How would XCode still be wanting to load this, and why only the errors in iOS6?
The problem is not in Xcode, but in the iOS Simulator. If you've removed all references to the .xib in your project, and cleaned everything as you described, the problem is that the .xib file still exists in the app bundle in the Simulator. You should try deleting the app from the Simulator (or better yet, Reset All Content & Settings on the Simulator). This will fix it.
what i know is that initWithStyle:UITableViewStyleGrouped will call the initWithNibName:Bundle: method...
your class had the same name as your nib file, so when you called the initWithStyle:UITableViewStyleGrouped it tried to load that nib file.
when you renamed your class, it didn't find an nib with the same class name so no errors showed up as before.
I decided to just rename my class and .h and .m files and that fixed the issue.
Who knows why.
My project built and ran completely fine. (it's rootViewController is a TabBarController) So I added two new view controller to my storyboard and connected them to my rootviewcontroller. In storyboard, the tabs were added just fine and everything looked okay. So I added the ViewController classes to my project and hooked them up to the correct viewControllers in storyboard. However, when I ran the project my new tabs were not visible in the simulator. So I ran "clean" on my project, deleted my application out of the simulator, reset the simulator to its original settings, and my new tabs still would not appear in the simulator. So i quit everything and restarted my mac. This time, when I ran my project it gave me the "Thread 1:signal SIGABRT" So i became frustrated and deleted my new viewControllers, both from the storyboard and the classes menu. I sent the classes to trash. But STILL I get the SIGABRT error. Even now that I am back to my original project, I am getting the error. I can't figure out what is wrong. Since it won't let me post a picture of my screen, just let me know if you need any additional debugger output or anything.
this is what its giving me in the debugger.
2012-07-05 09:22:33.336 NewsomeBand[265:15203] ***
Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: 'Could not
find a storyboard named 'MainStoryboard' in bundle
NSBundle </Users/tammyscheele/Library/Application
Support/iPhone Simulator/5.1/Applications/
1B3E088D-23A6-4B77-8CBB-390A9720818A/
NewsomeBand.app> (loaded)'
*** First throw call stack:
(0x152b022 0x30d2cd6 0x5179f2 0xecd60 0xecff8 0xec17f 0xfb183 0xfbc38 0xef634
0x16beef5 0x14ff195 0x1463ff2 0x14628da 0x1461d84 0x1461c9b
0xebc65 0xed626 0x202d 0x1f95)
terminate called throwing an exception(lldb)
From the debugger output that you posted it looks like you may have accidentally also deleted a reference to your main/root story board. I'm guessing this based on
'NSInvalidArgumentException', reason: 'Could not
find a storyboard named 'MainStoryboard' in bundle
Either that or did you accidentally rename it somewhere or misspell it? It looks like its something simple in any case.
I solved it! I went into the info tab inside my project and set "Main storyboard file base name" to "MainStoryboard", and also made sure that my storyboard was named "MainStoryboard". That seemed to fix everything
I spent several hours trying to load subclassed UINavigationController from another NIB while taping a tabBarItem. Does anyone have any idea, how to do it correctly?
The latest test:
MainWindow.xib - UITabBarController with 4 tabs, one is named News and is set to "Navigation Controller". While News tab is selected - class identity: NewsNavigationController, NIB Name: NewsView.
View loaded from NewsView appeared in the Window
Running this variant leads to:
Loading 123209 stack frames... (16%) and counting :) Removing class
identity ends with crash: *** Terminating app due to uncaught
exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value
coding-compliant for the key newsTableViewController.'
It's clear that Class indentity IS the way to go, but why does it not work for me?
From what I understand of the SDK, this exception is raised when the bindings in IB are not proper. But in my case, the view is loaded fine for the first two times. I then move back from the view using the NavigationController.
The third time when I try to open the view, I get this exception. The fact that it opens correct the first two times, means the bindings are correct and the view is fine! But then why does it fail the third time?
Any pointers?
Thanks.
I am calling -initWithNibName:bundle: to initialize the view which is created in IB. Not calling the -loadView method.
It is not getting garbage collected. AFAIK, there is no garbage collection in iPhone SDK and we need to dealloc stuff explicitly.
It seems that you have not bind the view to it's file owner.
For fixing this thing go open the xib which you are using in this ViewController. Right Click on your main view and then bind this view to the File Owener's view property.
You may be running low on memory, which forces the system to send out low-memory messages to instantiated view controllers. The default implementation of -didReceiveMemoryWarning clears out the view member variable. In theory, then next time the view is required, it should be re-instantiated, but you may have overridden something that's preventing that.
The view object might be going out of scope, and getting garbage collected.