Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-08-2011, 09:11 AM   #1 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 54
jcww33 is on a distinguished road
Default Adding a search barr to RSS reader

Hello,
I followed the tutorial available at Iphone Tutorial: Creating a RSS Feed Reader and wanted to add a search bar to the tableview and have it search the contents of the table. I Googled it and found nothing that worked. Any help that you could offer would be greatly appreciated.


Thanks!
jcww33 is offline   Reply With Quote
Old 01-08-2011, 12:16 PM   #2 (permalink)
Registered Member
 
DenVog's Avatar
 
Join Date: Jan 2009
Location: Silicon Valley, USA
Posts: 624
DenVog is on a distinguished road
Default

Quote:
Originally Posted by jcww33 View Post
Hello,
I followed the tutorial available at Iphone Tutorial: Creating a RSS Feed Reader and wanted to add a search bar to the tableview and have it search the contents of the table. I Googled it and found nothing that worked. Any help that you could offer would be greatly appreciated.


Thanks!
Have you had a look at Brian Slick's UITableView How-To: Part 2 - Search
DenVog is offline   Reply With Quote
Old 01-08-2011, 04:00 PM   #3 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 54
jcww33 is on a distinguished road
Default

Quote:
Originally Posted by DenVog View Post
Have you had a look at Brian Slick's UITableView How-To: Part 2 - Search
Yes, the app crashes when I type a character in a search bar.
jcww33 is offline   Reply With Quote
Old 01-08-2011, 06:04 PM   #4 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Ah, you must be the anonymous person who had the same problem as someone else, provided no more information, yet for some reason expected a different answer.

So, repeating that answer: my money is on a memory management issue in your parser.

Edit: at quick glance, that parser is leaking horribly. Leaks don't crash, but when I see memory management done that badly, I'm not at all surprised that something would be over-released or under-retained.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.

Last edited by BrianSlick; 01-08-2011 at 06:11 PM.
BrianSlick is offline   Reply With Quote
Old 01-08-2011, 08:06 PM   #5 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 54
jcww33 is on a distinguished road
Default

Quote:
Originally Posted by BrianSlick View Post
Ah, you must be the anonymous person who had the same problem as someone else, provided no more information, yet for some reason expected a different answer.

So, repeating that answer: my money is on a memory management issue in your parser.

Edit: at quick glance, that parser is leaking horribly. Leaks don't crash, but when I see memory management done that badly, I'm not at all surprised that something would be over-released or under-retained.
Yep, you guessed it. I guess I was hoping you would elaborate. I ran Instruments and found a ton of leaks. Tried releasing everything allocated and there is still a ton of errors. Care to help. Thank you so much for your helpful tutorial.
jcww33 is offline   Reply With Quote
Old 01-08-2011, 08:13 PM   #6 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

The parser needs to be using properties correctly. Fixing that will go a long way.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 01-08-2011, 08:18 PM   #7 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 54
jcww33 is on a distinguished road
Default

Quote:
Originally Posted by BrianSlick View Post
The parser needs to be using properties correctly. Fixing that will go a long way.
Really? @synthesize is used in the .m
jcww33 is offline   Reply With Quote
Old 01-08-2011, 08:19 PM   #8 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Read the properties link in my signature.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 01-08-2011, 09:02 PM   #9 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 54
jcww33 is on a distinguished road
Default

Hm, very interesting. So your saying I should be using self?
jcww33 is offline   Reply With Quote
Old 01-08-2011, 09:04 PM   #10 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Was that not stated clearly enough in the other thread?
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 01-08-2011, 09:27 PM   #11 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 54
jcww33 is on a distinguished road
Default

Yes, however i'm confused how this is done incorrectly. Maybe i'm not understanding something yet you state in the post is that you create an object, do something with it, and release it. The parser releases everything in the dealloc so I added self to each release and that didn't help. Thank you so much for helping me!
jcww33 is offline   Reply With Quote
Old 01-08-2011, 09:28 PM   #12 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Don't make me guess what you are doing. Post some code.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 01-08-2011, 09:32 PM   #13 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 54
jcww33 is on a distinguished road
Default

Ok, so I added self so it looks like this:

[[self items] release];
[[self responseData] release];
[[self currentTitle] release];
[[self currentDate] release];
[[self currentSummary] release];
[[self currentLink] release];
[[self currentPodcastLink] release];

and made sure item and current element had an @property and synthesized
jcww33 is offline   Reply With Quote
Old 01-08-2011, 09:36 PM   #14 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Never do that. That's just making things worse. What in the other thread lead you to believe that is what you should do?

Keep rereading the properties thread until this stuff sinks in. You have to understand it.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 01-08-2011, 09:43 PM   #15 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 54
jcww33 is on a distinguished road
Default

Oops, i'll read it a couple times over. I think I need to add self to the methods in the Parser.
jcww33 is offline   Reply With Quote
Old 01-09-2011, 01:10 PM   #16 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 54
jcww33 is on a distinguished road
Default

Quote:
Originally Posted by jcww33 View Post
Oops, i'll read it a couple times over. I think I need to add self to the methods in the Parser.
Ok, so I think a major issue is in the parser didStartElement void statement. In your common mistakes post, you talk about how you shouldn't combine alloc/init and self in the same line. This is what's done in the parser didStartElement void. You also state that the parser should autorelease the objects. However, the objects are used later in the code. So when should I release this objects? Or am I reading this all wrong?
jcww33 is offline   Reply With Quote
Old 01-09-2011, 01:57 PM   #17 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Those are problems, yes. Certainly not the only ones.

Autorelease doesn't mean the object dies. It means release later. This balances the alloc.

Keep rereading the properties thread. I think you're starting to head towards understanding, but you're not quite there yet.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 01-11-2011, 08:30 PM   #18 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 54
jcww33 is on a distinguished road
Default

Quote:
Originally Posted by BrianSlick View Post
Those are problems, yes. Certainly not the only ones.

Autorelease doesn't mean the object dies. It means release later. This balances the alloc.

Keep rereading the properties thread. I think you're starting to head towards understanding, but you're not quite there yet.
Focusing on the parser didStartElement, the whole thing is coded in dot syntax. This is confusing me. How do I convert it so it is no longer written in dot syntax so I can autorelease it?
jcww33 is offline   Reply With Quote
Old 01-11-2011, 08:34 PM   #19 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

The syntax doesn't matter. And the difference is mentioned in the properties thread.

As it stands now:

Code:
self.currentTitle = [[NSMutableString alloc] init];
As it should be:

Code:
self.currentTitle = [[[NSMutableString alloc] init] autorelease];
Or: (I don't like dot syntax)

Code:
[self setCurrentTitle:[[[NSMutableString alloc] init] autorelease]];
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 01-17-2011, 08:22 AM   #20 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 54
jcww33 is on a distinguished road
Default

So I made the corrections. Still dosen't work. I am confused as to what else is leaking.
jcww33 is offline   Reply With Quote
Old 01-17-2011, 08:24 AM   #21 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Quote:
Originally Posted by BrianSlick View Post
Don't make me guess what you are doing. Post some code.
.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 01-17-2011, 09:32 AM   #22 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 54
jcww33 is on a distinguished road
Default

Quote:
Originally Posted by BrianSlick View Post
.
if ([elementName isEqualToString:@"item"]) {
self.item = [[[NSMutableDictionary alloc] init] autorelease];
self.currentTitle = [[[NSMutableString alloc] init] autorelease];
self.currentDate = [[[NSMutableString alloc] init] autorelease];
self.currentSummary = [[[NSMutableString alloc] init] autorelease];
self.currentLink = [[[NSMutableString alloc] init] autorelease];
self.currentPodcastLink = [[[NSMutableString alloc] init] autorelease];
}
jcww33 is offline   Reply With Quote
Old 01-17-2011, 09:34 AM   #23 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Those weren't the only problems in the code.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 01-18-2011, 04:41 PM   #24 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 54
jcww33 is on a distinguished road
Default

Quote:
Originally Posted by BrianSlick View Post
Those weren't the only problems in the code.
Yes, I know however can't find many others. I did the same thing under the connection didFailWithError

Code:
 UIAlertView * errorAlert = [[[UIAlertView alloc] initWithTitle:@"Error loading content" message:errorString delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil] autorelease];
However other then that, anywhere else something is allocated, I try autoreleasing it and get no errors/warnings yet the app crashes.
jcww33 is offline   Reply With Quote
Old 01-18-2011, 04:49 PM   #25 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

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.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Reply

Bookmarks

Tags
iphone, search, tableview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 366
7 members and 359 guests
blueorb, fredidf, iAppDeveloper, iGamesDev, mottdog, sacha1996, Touchmint
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,667
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, host number one
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:32 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0