This question already has answers here:
Xcode - How to fix 'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X" error?
(79 answers)
Closed 7 years ago.
I have performed some changes on my storyboard file and deleted a bar button. Before deleting, I removed all the connections in both storyboards for both screens.
Next, I deleted all the code, connected with this button.
Now I'm getting an error on startup:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason:
'[<TTPDepartmentViewController 0xe805bd0> setValue:forUndefinedKey:]:
this class is not key value coding-compliant for the key nextButton.'
I've checked for this nextButton all over the source code of storyboards and all. No sign, no connections, still this error bumps out. More, I've reseted the simulation. What can I do?
UPD: I totally removed the problematic (as I thought) storyboard and the problem still appears, even that other storyboards do not contain these views with this key at all.
UPD2:
As you can see the connection thing is not filled, so there should be no connection. When I uncomment this line it builds and runs, though it is not obviously used at all.
select file's owner in your document outline window and switch to connections inspectors tab. More likely than not, you will see a connection with a yellow exclamation sign on it saying "nextButton". Just remove that and you should be good to go.
Well, this was the case now:
https://stackoverflow.com/a/21883809/2084479
I don't know, why but even before this bug appeared, I had "Main" in my Main Interface in the deploy info, but this was working. Now, I've updated to some other value (in the answer it's told that you can even leave it blank) and this fixed the build.
Related
If you have a storyboard/XIB with an IBOutlet connected to the corresponding IBOutlet property in your code and then you delete the outlet in code, you used to crash with a rather cryptic error message to the effect that "this class is not key value coding-compliant for the key <outlet_name>"
This isn't my first Xcode rodeo, so I'm used to that message. I see it and thing "oh crap, I've either got a broken outlet link or a user-defined runtime attribute that points to an invalid key name" and go fix it.
However, my company just moved to Xcode 9.1 (I know, we should be on 9.2, never mind 9.1, but we have a big team and a huge mixed Swift/Objective-C codebase, and migrating our toolchain is fraught with complexity.) I just had a merge error where a now-defunct outlet was left in a Storyboard.
When I ran the app and exercised the code-path that should display this scene in my storyboard, I got a crash in main.m, with nothing in the stack trace, and no clues in the console. Just SPLAT.
I wasted 2 hours tracking this puppy down.
The error message used to be cryptic as h**l, but at least it gave you a clue. Now it seems you just crash with no explanation.
Apple didn't remove this feature in Xcode 9+, I have tested both with Xcode 9.1 and Xcode 9.2.
I think there are several ways can reproduce this issue:
Using console Filter may cause some logs disappear that moment. Clean filter could bring them back.
Using exception breakpoint as Rob says in question comments. Continue execution or disable breakpoint, uncaught exception error would come out.
I suggest you to new a sample project to check it again. If the problem is still there,a screenshot or sample project is welcome.
I am trying to implement the CAS login objective-C code to my current Xcode project but I keep having code compilation errors everytime I try to get the text from one of my IBOutlets the error comes up. Here is the code for the CAS View Controller:
CASViewController.m - Look at the username and password strings that's where the problem is
CASViewController.h - the username and passwords swift IBOutlets are hat connect the storyboard to code and which are causing the problem
I am new to swift so I've been looking around to get this working. I have made the CAS client a static linked library and I have made a bridging file to connect the code however I am still at a loss. Thank you in advance for the help.
the error I am getting:
error is:2017-07-03 12:31:22.520 SAF[2947:45298] Unknown class _TtC11CAS library17CASViewController in Interface Builder file. 2017-07-03 12:31:22.530 SAF[2947:45298] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]:
UILabel IBOutlets are missing the required connection. You need to connect them to the labels in Storyboard's UIViewController.
Specifically, UILabel authResultMessage isn't connected to Storyboard. Use Ctrl+drag to connect it with relevant label in Storyboard.
I recently renamed my project and a variety of errors came up relating to the paths that Xcode was trying to use to access my files.
This was most likely due to an ill attempt at renaming the project so I retracted my efforts and decided I would just change the name of the App the customers see. Anyways a peculiar error has risen up because of this.
When I build the app it crashes with a THREAD 1 SIGABRT error. Here is the output of the console.
Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: 'Could not find a storyboard
named 'Main' in bundle NSBundle
(loaded)'
*** First throw call stack: (0x18b2341c0 0x189c6c55c 0x191835bd0 0x191306b48 0x1910ef0a8 0x1913057c0 0x19131a080 0x1913028c4
0x18cdd58bc 0x18cdd5728 0x18cdd5ad0 0x18b1e2278 0x18b1e1bc0
0x18b1df7c0 0x18b10e048 0x1910e85dc 0x1910e3360 0x100037bb8
0x18a0f05b8) libc++abi.dylib: terminating with uncaught exception of
type NSException
I have cleaned my project several times as well as doubled check the plist to ensure the string was correct. Here is a link to a similar question whose answer I tried.
Could not find a storyboard named 'Main' in bundle
I found my problem but still am not sure how to fix it. In my main storyboard under The File Inspector my TARGET MEMBERSHIP for the App is GREYED OUT but the Test and UITest version of it are not.
I have tried a variety of build with different checks as well as deleted the app off of my physical device and cleaned the project and tried again. I even deleted the reference to the Main.storyboard and re-added by dragging from a pane like in one of the answers on the link provided and it lets me select all the Target Membership's but when I open the File inspector only the tests are selected on not the main top option. Can anyone help me out on this?
It would be greatly appreciated, I have been at it for hours and I am sure it is something small I am missing.
have you tried to verify the your info.plist?
you can also create a new storyboard (copy all viewController in Main.storyboard) and then in "Main storyboard file base name" key of your plist set the value of your new storyboard name.
Or check this Build Settings:
check also the target associated it.
I made simple app with 2 languages. When it was done I've decided to delete one language (and did so): I deleted language from project-info-localizations.
After that I've tested app on the device (iPhone) and found that app still has additional (deleted) language. Then I've deleted the app from the iPhone and run project again - it had no sense to my changes. I don't understand the reason... However, later I've found mistake (grammar) in the name of the button and renamed it. That action completely killed my app - it can't be run on the iPhone from that very moment.
Error is: 2013-01-25 11:46:34.087 timeLimiter[13649:907] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key startAlerButton.'
It mentions "startAlerButton" which was renamed (I've checked all relations in .h, .m, storyboad).
Please check if there is still some connection to outlet startAlerButton in the xib files.
I removed an attribute from an object; I made sure there is no reference to it after I took it off; but when I run the app it crashes upon a certain method saying that it cannot find this attribute that I had removed.
To be more specific, I used this attribute in a method and the error I get in the log is:
2011-08-04 15:32:17.895 myApp[10125:207] -[myUIViewController aMethodName:anAttributeThatIHadDeleted:]: unrecognized selector sent to instance 0x5e5d010
2011-08-04 15:32:17.962 myApp[10125:207] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[myUIViewController aMethodName:anAttributeThatIHadDeleted:]: unrecognized selector sent to instance 0x5e5d010'
I tried the following and it didn't help:
I made sure that this anAttributeThatIHadDeleted does not appear in this method (nor in the h file neither in the m file)
I deleted the app from the iPhone Simulator, and then did Product >> Clean
I even closed the simulator, closed the application, after I did this delete + clean actions
Can anyone think of anything else I can do to resolve this?
If you're absolutely sure the method doesn't exist anymore, I'd delete it from the simulator, quit the simulator, quit XCode, delete the "build" folder in Finder of you project and then start them all again
There was one thing I forgot to do.....
Deleting the Interface Builder >> UIButton connection to the File's Owner IBAction method and re-connecting it to the new one (it was the same one, I just deleted an attribute from it, but apparently it doesn't sync with IB, you have to do it manually...)