xcode terminating app due to uncaught exception - iphone

I have made an app in xcode and whenever I build or run the app it says there are no issues but then after the launch image displays the app seems to crash and throw up this error.
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key high_score_outlet.'
* First throw call stack:
(0x1c24012 0x1609e7e 0x1cacfb1 0xcae41 0x4c5f8 0x4c0e7 0x76b58 0x619019 0x161d663 0x1c1f45a 0x617b1c 0x6198da 0x3fb68b 0x3fb9a2 0x3fa876 0x40bcb5 0x40cbeb 0x3fe698 0x255fdf9 0x255fad0 0x1b99bf5 0x1b99962 0x1bcabb6 0x1bc9f44 0x1bc9e1b 0x3fa17a 0x3fbffc 0x211d 0x2055)
libc++abi.dylib: terminate called throwing an exception
I am not quite sure why it is crashing because it says that there are no issues in the code when building or running the app.
Any ideas how to fix it?

You may have renamed your properties and forgot to reconnect the IBOutlet to your component in the Interface Builder file. Whenever you change a property in code that is an IBOutlet, you should check Interface Builder and reconnect that item if the connection was broken.
Your app will compile just fine because Interface Builder Outlets are connected at runtime, when the nib is being loaded.

It is most likely an IBOutlet that has gotten out of date.
Go to the first controller that will be loaded in your storyboard and check out the Connections Inspector (⌥⌘6) and look for an outlet connected to high_score_outlet.
This may be left over from an earlier refactoring. You'll want to disconnect it and set up the correct connection

Check whichever class has the property -high_score_outlet. The message you're getting means that the runtime can't find the relevant property implementation, so either:
you haven't defined it correctly in the class, or
you are calling it on an object that isn't the class you think it is. Use the debugger to verify the class of the object on which the method is being called.

Related

Xcode error at runtime

You can see the error in the image.
I don't even know what these errors mean, it was working fine before I updated Xcode for the iOS 6 update. I've done a few things to try and fix it such as change the target OS and do a Clean, but that has not worked.
I get the error after the app successfully is built and pushed to the device.
Your application crashed at runtime, because there was an exception.
The exception is written in your console log. We can see it in your capture:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIApplication 0x...> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key view.'
This means that somewhere in your application, you tried to set the "view" property of an object of type UIApplication, but UIApplication does not have any view property, so this crashes.
This is very likely that in your MainWindow.xib file, you connected a view IBOutlet to an object of type UIApplication, but this binding of your outlet is invalid because the outlet does not exist anymore.
(maybe you added the outlet at a given time, and binded/connected it in IB, and then removed it in your code, or maybe you binded the IBOutlet then changed the class of your object so the new class does not have the same outlets at all, whatever the outlet is now binded to a non-existant property in your XIB and that generates the crash)
To fix this, open your XIB file in interface builder and remove this invalid connection to your now non-existant outlet, and your exception should go away.
It means your program crashed. The error is in that box in the corner right. I can't see the whole error message, but it has something to do with key-value coding.
It might be the simple fact that you're running a slightly outdated version of your program. Delete it from the simulator or your device, clean and re-build your project, and let Xcode re-copy it over.

iPhone exception handling crash my app

I am new on ios and i am following a tutorial to develop a calculator.
When i build my project it succeds, but on run time it crashes and throwa an exception:
`2012-09-19 10:03:51.469 AhsanCalculator[325:f803] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<ViewController 0x6d59870> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key pushOperand.'
*** First throw call stack:
My code is here if you need more detail. Tell me what you need and i will give you all the details.
Xcode = 4.3.3
5.1 iPhone simulator
Please help to solve this issue
The crash occurred for you is because, in your xib you have linked/connected some wrong objects, i mean a UITextField to a UITextView or some thing like that.
When you open Xib right clicking on the files owner object, it shows some of the IBOutlets connected with a warning icon, delete those and connect to the right/correct one.
This will clear your crash, and works fine.
As you are new to iOS development, here are some link to learn about what to when a crash appears in the project,
Its is by Raywenderlich, here it is a 2 part tutorial part 1 and part 2.

App terminating due to uncaught exception NSUnknownKey Exception , key value not coding compliant [duplicate]

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.
Sorry for asking such an easy question, but im a beginner
I was following a tutorial on building apps.
I was creating a button, but i accidently named it wrong, i named it instead of when creating the outlet. I named it right though when i created the action. I ran my app and it failed, because my instances called on , not (at least i think thats why my app crashed. So deleted the outlet and and the automatic code xcode writes for the outlet, i remade the outlet and named it right this time. But now when i run my app it terminates, heres the report:
2012-08-21 20:42:07.602 FieldButtonFun[973:c07] * Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key theNutton.'
* First throw call stack:
(0x14b2022 0xeb2cd6 0x14b1ee1 0x9c3022 0x934f6b 0x934edb 0x94fd50 0x23771a 0x14b3dea 0x141d7f1 0x23626e 0xdc1fc 0xdc779 0xdc99b 0x3b401 0x3b670 0x3b836 0x4272a 0x13596 0x14274 0x23183 0x23c38 0x17634 0x139cef5 0x1486195 0x13eaff2 0x13e98da 0x13e8d84 0x13e8c9b 0x13c65 0x15626 0x271d 0x2685)
terminate called throwing an exception
I have no idea what went wrong and i dont understand the error report at all. I thought i already deleted all the automatic code Xcode generated when i created the outlet and remade it. Could anyone help me and find out what could have went wrong?
I could rebuild this app from scratch but i want to understand why this went wrong, for future reference.
Xcode cannot find the value for the key theNutton in the class FieldButtonFun.
It's hard to say what's wrong without see the actual code. But in most cases, there could be a bad connection in the XIB file. Please check the XIB, ctrl-click the File's Owner, see if there is any yellow warning.
Click on your .xib then you will see the files'Owner on top right click on it and check you have any connection in yellow if you have then please click on cross button(X) and from xib right click and drag connection to filer'owner from your uibutton to make action(method)connection.
Then right click and drag from filer'owner to IBOutlet(the uiobject you declare as IBOutlet in your interface).

Error on empty project: "this class is not key value coding-compliant for the viewcontroller."

this error drives me crazy. I already spent hours on fixing this, unfortunately without success.
I tested my app in simulator, everything works fine. I'am testing it on my device (iphone 4 with ios 4.3.3) the app won't start.
So I tried creating a new project, build and go. And the end of the error now says instead of viewcontroller, key window.
To get further information about the error I setup an exeption breakpoint whicht breaks on throw and on all exeptions. Something interesting happend now: when I am launching the empty project on my iphone I get a warning:
warning: Unable to read symbols for /Users/xxx/Library/Developer/Xcode/DerivedData/testing-cmaekkzgdqyseidlqkorvrdvvodg/Build/Products/Debug-iphoneos/OLDAPP.app/testing (file not found). (The app which I am runnning is called testapp, not OLDAPP?! This was my last project!)
Some further errors now occure:
Unknown class OLDAPPAppDelegate in Interface Builder file. and Unknown class RootViewController in Interface Builder file.
I did clean all targets and made a clean build. Nothing changes…
I didn't change anything in IB, just edited the provisioning profile to run the app on my phone.
Help is very appreciated here :-) Hopefully someone can help me I would be really thankful.
The whole error message: *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UICustomObject 0x18b410> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key window.'
This happens to me if I change the name of an outlet on the ViewController which was connected to something in the View in Interface Builder. For example, renaming 'labelFirstName' to 'lblFirstName' and forgetting to break and recreate the connection in IB.
I had the same problem where there were no !'s in my XIB and no re-naming problems. To fix it, I just created a new XIB, copied in the view from the old XIB, and rewired all the connections.

Universal application error

I'm trying to realize an universal application (for iPhone/iPad), and I'd like to use the same UIViewController to set up the behaviour for both of the devices.
I got a surprising error at launch time, which is :
2010-07-15 11:31:03.420 AppUniverselle[2761:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x7000670> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key myLabel.'
2010-07-15 11:31:03.421 AppUniverselle[2761:207] Stack: (
29291611,
2421585161,
...
2727445,
2764719,
8884,
8738
)
I can't figure out where I failed. Furthermore, to avoid any typo problem, I restarted the project, but it ends on the same error.
The main surprising point is that the application works fine on the iPad simulator, but not on the iPhone one. Perhap's there is a problem with the iPhone simulator ?
Does someone know the answer of this question or ever heard about that kind of problem ?
It looks like you have an outlet called myLabel in your NIB file, but there's no such outlet in your view controller instance.