App crashes when i stringByReplacingOccurrencesOfString - iphone

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.

Related

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.

Weird iCloud transaction log error

Yet another day, yet another iCloud error, I'm trying to get to some sort of stability. at least for a little functionality. Please explain to me what this error is about.
Here's when it occurred: Two devices sharing the same app (obviously). Both work quite well when both are online.
But, I took my iPhone without a sim and a network out for a day, added a bunch of stuff to it. And all changes are reflected within the app (obviously) and came back home, iPhone went online automatically via wifi. I didn't touch the iPhone nor did I open the app.
I fired up the iPad and launched the installed app. I expected the changes to just magically appear after taking some time of course, instead only a single update happened. That too was related to adding a new "User" entity. Not the stuff in it, or other new entities in it or related.
Here's the log part which I think is responsible, please tell me what's that all about, how did fetchedProperties come in? And how isToMany in there?
[NSFetchedPropertyDescription isToMany]: unrecognized selector sent to instance 0x43ad70
2012-02-24 23:06:01.216 App[3922:3877]
CoreData: Ubiquity: Error importing transaction log: <PFUbiquityTransactionLog: 0x4a198c0>
transactionLogLocation: <PFUbiquityLocation: 0x5685140>: /private/var/mobile/Library/Mobile Documents/PRSWRAABE7~com~testcloud~app/hgdata/mobile.D188D9B6-3C35-5E55-BB09-9BD78EC0CA64/com.testcloud.app/Zi4JIL_IINn2U12TdLepz0QoF922tqFvbcUPpcr3blU=/D320175C-FFA1-4C5C-A8C9-7CD23E85CAFD.1.cdt
transactionNumber: 39,
exception: -[NSFetchedPropertyDescription isToMany]: unrecognized selector sent to instance 0x43ad70
2012-02-24 23:06:01.216 App[3922:3877] -[_PFUbiquityRecordsImporter operation:failedWithError:](839):
CoreData: Ubiquity: Import operation ecountered an error:
Error Domain=NSCocoaErrorDomain Code=134060 "The operation couldn’t be completed. (Cocoa error 134060.)"
UserInfo=0x63359a0 {exception=-[NSFetchedPropertyDescription isToMany]: unrecognized selector sent to instance 0x43ad70}
while trying to import the log file at the URL: <PFUbiquityTransactionLog: 0x4a198c0>
transactionLogLocation: <PFUbiquityLocation: 0x5685140>: /private/var/mobile/Library/Mobile Documents/PRSWRAABE7~com~testcloud~app/hgdata/mobile.D188D9B6-3C35-5E55-BB09-9BD78EC0CA64/com.testcloud.app/Zi4JIL_IINn2U12TdLepz0QoF922tqFvbcUPpcr3blU=/D320175C-FFA1-4C5C-A8C9-7CD23E85CAFD.1.cdt
transactionNumber: 39
unrecognized selector sent to instance 0x43ad70 this message says that something going wrong with your code.
what is [NSFetchedPropertyDescription isToMany] ?? maybe it says that there are too many import transactions? looks weird

App crashing, help needed understanding the error [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.
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!

How to solve the error of "[_NSCFTimer login:]:unrecognised selector sent to instance

I have created an application. When I run my application I get the following error:
-[__NSCFTimer login:]: unrecognized selector sent to instance 0x4b37380
2011-04-12 10:57:36.441 Journey[6190:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFTimer login:]: unrecognized selector sent to instance 0x4b37380'.
How can I solve the above mentioned error?
Are you calling login method on the instance of NSTimer ?
If yes, you can't, you could only call methods on the instance of NSTimer those declared in NSTimer class
See the apple documentation for NSTimer.
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class/Reference/NSTimer.html
Under Build Settings, add "-ObjC" to the "Other Linker Flags" section.
The reference:
Error when try to start scanning chromecast device

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?