Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jeremyapp

macrumors newbie
Original poster
Apr 30, 2008
27
0
Hey,

I'm still somewhat new to this, so please bear with me if this is a simple question.

I have an Tab Bar application with four tabs. Each tab has its own xib file and each are linked to a single "FirstViewController" file. In the first tab, I currently have a UITableView set up and linked to a data source and delegate ("FirstTable"). This table also uses a subclass of UITableViewCell for customization. I have been able to get the data in my first tab and it works great.

With that one working, I went to the second tab (opened up SecondView.xib, which is linked to it), and added a new UITableView. I created a "SecondTable" class and linked it to the table as the data source and delegate. I also created another subclass of UITableViewCell, specific to that table.

The application compiles just fine, but crashes and throws "_objc_error" when I try to switch to the second tab containing the second table.

Is there something obvious that I'm doing wrong, or have I not provided enough information? I'd provide some code, but I'm not sure what would be relevant in this case. Please let me know. Thanks!
 
Hey,

I'm still somewhat new to this, so please bear with me if this is a simple question.

I have an Tab Bar application with four tabs. Each tab has its own xib file and each are linked to a single "FirstViewController" file. In the first tab, I currently have a UITableView set up and linked to a data source and delegate ("FirstTable"). This table also uses a subclass of UITableViewCell for customization. I have been able to get the data in my first tab and it works great.

With that one working, I went to the second tab (opened up SecondView.xib, which is linked to it), and added a new UITableView. I created a "SecondTable" class and linked it to the table as the data source and delegate. I also created another subclass of UITableViewCell, specific to that table.

The application compiles just fine, but crashes and throws "_objc_error" when I try to switch to the second tab containing the second table.

Is there something obvious that I'm doing wrong, or have I not provided enough information? I'd provide some code, but I'm not sure what would be relevant in this case. Please let me know. Thanks!

What does the console say after the crash?

Run -> Console
 
objc[640]: FREED(id): message numberOfSectionsInTableView: sent to freed object=0xd5edf0

...I can find that method called in my UITableViewController subclasses:

Code:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 3;
}

Is there something I need to retain somewhere?
 
Update:

It looks like the problem is in the
Code:
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
call in the UITableViewController subclass for my second UITableView. After some debugging, I've found that this subclass, called "Contact" is being released for some reason. When I comment out its [super dealloc] method, it runs. Of course this isn't going to fly in the real world, but hopefully that's another clue.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.