App crashing, help needed understanding the error [duplicate] - iphone

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.
After changing "something, i can't trace back", my app is crashing with the following error:
2011-10-29 15:31:50.842 UnblockMe[6900:f803] *** Terminating app due to uncaught exception
'NSUnknownKeyException', reason: '[<UIApplication 0x6e551b0> setValue:forUndefinedKey:]:
this class is not key value coding-compliant for the key goBackButton.'
Only 1 class references the "goBackButton". I rebuilt the relationships to and from this button since (Yet the problem persists)
Other then this, project contains no errors or warnings. "Clean" did not seem to help. Removing app and reinstalling it on the simulator produced no results.

The strange thing about that error is it's supposed to tell you what the affected object is. See this link where somebody has a similar problem. What that makes me think is you have an overreleased object. That results in a pointer to nonsense memory. When you try to send a selector to it, strange things can happen.

The error means that something is not properly connected in IB!
Check your xib connections, you could have renamed an outlet and you forgot to change the connections!

Related

NSUnknownKeyException? statusBarManager

I'm getting this error whenever I run my app and then the app crashes.
Thread 1: "[<UIApplication 0x161704080> valueForUndefinedKey:]: this class is not key value coding-compliant for the key statusBarManager."
I've tried googling this and it seems people have had the problem before, but either I don't understand the solution whatsoever, or the solution they present doesn't work for me. Any ideas?
Also here are the files for the project in google drive https://drive.google.com/drive/folders/1TzQgwC_CgEC_wertNmyF0ZrL_vKFgILS?usp=sharing

NSInvalidUnarchiveOperationException?

The current app I have been working on has been running fine with no issues and suddenly, what seems like out of the blue as I hadn't made any changes, crashes at launch with an NSInvalidUnarchiveOperationException.
I made zero code changes and the only thing I did was to run the app on my Mac to see how it would look on MacOS. I then ran it again on my iPhone and that's when the problem started to occur. I use CoreData and CloudKit so decided to delete all data to see if that would solve the issue (not thinking it would based on the console log) and it still crashes.
The console states the following:
Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: '*** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (NSFontDescriptor) for key (UIFontDescriptor) because no class named "NSFontDescriptor" was found; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target). If the class was renamed, use setClassName:forClass: to add a class translation mapping to NSKeyedUnarchiver'
The thing is, although I use attributed strings I clearly haven't created a class named NSFontDescriptor. NSFontDescriptor is part of the SDK so I have no idea what's going on and how to fix this issue.
Any help would be much appreciated.

iOS Framework not able to create object

I have created a iOS framework in which I only have a UIView Class (let say X) in which I have declared some datasource and delegate methods.
Now when I am using the framework in a project and try to create a object of X, it gives me following error:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_X", referenced from:
objc-class-ref in ViewController.o
Now if I take a UIView in XIB and change its class to X and connect it to an outlet and then setDelegate and setDatasource it throws an exception:
Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '-[UIView setDataSource:]: unrecognized selector sent to instance 0x756f670
if I don't do the above two steps. it builds and runs fine.
I hope I am clear with question. Thanks for any help in advance.
As for 1:
The reason is that the framework is not built for the iPhone Simulator. I had a similar issue with CocosDenshion, documented in this SO Question of mine (someone didn't like it though, for some reason).
The easiest solution is put your project and your framework into an Xcode Workspace and Xcode will build the framework for the iPhone Simulator as and when required. If you don't want to do that then follow the instructions in the SO question linked above.
As for 2:
You need to provide the methods specified; it looks like you changed a UITableView-based class and changed it to a UIView-based class, which won't work. Derive the new class from UITableView and things should start rolling again.

App crashes when i stringByReplacingOccurrencesOfString

this is the error given in the console. I'm taking a search term and replacing the " " with "+" so it goes into a URL ok, it then fetches RSS feeds based on that search term, this works fine but when i press the refresh button on the toolbar, it crashes with this error:
-[UITableViewCellLayoutManagerSubtitle stringByReplacingOccurrencesOfString:withString:]: unrecognized selector sent to instance 0x5b67be0
2010-11-14 19:58:01.325 Example[63210:1903] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableViewCellLayoutManagerSubtitle stringByReplacingOccurrencesOfString:withString:]: unrecognized selector sent to instance 0x5b67be0'
This is actually my code: terms = [terms stringByReplacingOccurrencesOfString:#" " withString:#"+"];
terms was prematurely released, most likely because you didn't retain it properly in the first place. Coincidentally, an instance of UITableViewCellLayoutManagerSubtitle was subsequently allocated at said address that terms points to leading to the unrecognized method exception.
Use Zombie detection in Instruments to find the problem.
Also, use "Build and Analyze" as it is quite likely the llvm static analyzer will identify the issue.
It's possible that terms is being released prematurely and UITableViewCellLayoutManagerSubtitle is being alloced at the same memory address. Check your retain/release/autorelease commands are correct.

Error compiling for unit test using google toolbox for mac

Hi my application runs fine but when I try to run the unit tests I am getting this error...
2010-10-19 00:27:49.919 AssignmentUnitTest[27988:903] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:
'*** -[NSURL initFileURLWithPath:]: nil string parameter'
Irony is I have searched the whole project & I dont have any similar line of code that uses **[NSURL initFileURLWithPath:]**
I have pretty much wasted half of my day on it without any success.
I am using coredata in the project & below is the screen shot with stack trace.
Can anyone please guide me to the right direction.
Thanks
**EDIt : ** The solution to this problem is to add not only the .xcdatamodel file but the root file .xcdatamodeld. Core Data was having trouble finding my model so was displaying this error. Hope it helps somebody someday.
Read the call stack in your screenshot. It says your managedObjectModel method sent [NSURL fileURLWithPath:], and that called initFileURLWithPath:. So, find the point where you sent [NSURL fileURLWithPath:] and fix your argument to that message.
The argument you passed being invalid suggests that either you passed nil for the path (perhaps you tried to find the file in your bundle but it isn't there or has a different name than you looked for), or you passed a pointer to an object that isn't a string (perhaps you had a string but under-retained it and a different object was created in its place).
There is a bug in some version(s) of the SDK that broke exception handling in the simulator.
Can you run the tests on a device?