Leaks don't cause crashes. Crashes (assuming a memory-related issue) will be due to (at least) one of the following:
1. Something is over-released
2. Something is under-retained
I already stated this before.
Don't just go around blindly slapping autoreleases on things. You potentially cause more problems, or make existing problems worse.
Also, it's possible that you have fixed the parser, and now have problems in the rest of your app.
Well, I removed the autorelease since it caused the crash (probably over releasing) and still when I type a character in the search bar, it crashes. I added other code to the app but nothing major.
Well, I removed the autorelease since it caused the crash (probably over releasing) and still when I type a character in the search bar, it crashes. I added other code to the app but nothing major.
Leaks don't cause crashes. Crashes (assuming a memory-related issue) will be due to (at least) one of the following:
1. Something is over-released
2. Something is under-retained
I already stated this before.
Don't just go around blindly slapping autoreleases on things. You potentially cause more problems, or make existing problems worse.
Also, it's possible that you have fixed the parser, and now have problems in the rest of your app.
Well, I removed the autorelease since it caused the crash (probably over releasing) and still when I type a character in the search bar, it crashes. I added other code to the app but nothing major.
Made some progress. Their are still leaks coming from the parser didStartElement, along with the parser didEndElement. These two lines of code seem to leak in the parser didEndElement:
Although, you probably don't want to put currentTitle directly into the dictionary. It's a mutable string, which means it can be changed. You'll only wind up with the very last value it had, across each of your dictionaries. You should copy it first, and then it would be something that should be released.
Although, you probably don't want to put currentTitle directly into the dictionary. It's a mutable string, which means it can be changed. You'll only wind up with the very last value it had, across each of your dictionaries. You should copy it first, and then it would be something that should be released.
I just realized this but the console says "Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary rangeOfStringptions:]: unrecognized selector sent to instance 0x66586d0" But what do you mean by copy it first?
My guess is that's coming from the search routine. Either you are not searching against the right kind of object, or you still have a memory issue.
Code:
NSString *anotherString = [aString copy];
Sorry, I must have misinterpreted that. But still how does that help. I am also confused on how to copy it. You gave me the code (thank you) however what do I do with the variable another string (or am I misinterpreting that to)?
Copying is to make sure you get the right value. With a mutable string, since the value can change, each time you change the mutable string, the value will change in all places. So once you get this up and running correctly, you would find that all of your parsed objects only have the very last value. Copying the string makes sure you capture the value at that time.
Don't worry about it for now. Get the parser working first.
Copying is to make sure you get the right value. With a mutable string, since the value can change, each time you change the mutable string, the value will change in all places. So once you get this up and running correctly, you would find that all of your parsed objects only have the very last value. Copying the string makes sure you capture the value at that time.
Don't worry about it for now. Get the parser working first.
I made more progress. Finding/fixing is actually kinda fun and definitely feels good when completed. I got rid of the leak on