Welcome, Guest
Username Password: Remember me

Scrolling all the way down to a tableview causes a EXC_BAD_ACCESS
(1 viewing) (1) Guest
  • Page:
  • 1
  • 2

TOPIC: Scrolling all the way down to a tableview causes a EXC_BAD_ACCESS

Scrolling all the way down to a tableview causes a EXC_BAD_ACCESS 1 year, 7 months ago #1

On the stack the last culprit show as:
SCTableViewSection.c line 1384

I sent the details over the support alias.

In a nutshell this is the code that I have added
- (void) populateTableTweets:(NSMutableArray *)tweets {

tableModel = [SCTableViewModel alloc] initWithTableView:self.tv
withViewController:self];

SCArrayOfObjectsSection *lastTweetStream = [SCArrayOfObjectsSection
sectionWithHeaderTitle:@"My Teweets" withItems:myTweets];
lastTweetStream.allowEditDetailView = NO;
lastTweetStream.allowDeletingItems = NO;
lastTweetStream.allowMovingItems = NO;
[tableModel addSection:lastTweetStream];
}


- (void)tableViewModel:(SCTableViewModel *)tableViewModel
willDisplayCell:(SCTableViewCell *)cell forRowAtIndexPath:(NSIndexPath
*)indexPath
{
cell.imageView.image = [UIImage imageNamed:@"abutton.png"];
NSDictionary *record = [myTweets objectAtIndex:indexPath.row];
//NSLog(@"%@",[record allKeys]);
cell.textLabel.text = [record objectForKey:@"text"];
[record release];
}

- (void)tableViewModel:(SCTableViewModel *) tableViewModel
willConfigureCell:(SCTableViewCell *) cell forRowAtIndexPath:(NSIndexPath
*) indexPath
{
cell.height = 70;
cell.textLabel.lineBreakMode = UILineBreakModeWordWrap;
cell.textLabel.numberOfLines = 0;
[cell.textLabel setFont:[UIFont systemFontOfSize:10]];

UIButton *aButton = [UIButton buttonWithType:UIButtonTypeCustom];
[aButton setImage:[UIImage imageNamed:@"abutton.png"]
forState:UIControlStateNormal];

[aButton addTarget:self action:@selector(buttonPushed:)
forControlEvents:UIControlEventTouchUpInside];

aButton.frame = CGRectMake(8, 8, 55, 55);
[cell addSubview:aButton];
}
  • amok
  • OFFLINE
  • Fresh Boarder
  • Posts: 8
  • Karma: 0

Re: Scrolling all the way down to a tableview causes a EXC_BAD_ACCESS 1 year, 7 months ago #2

Hi amok,

Is this the same project you sent us before and I edited it? Are you able to kindly send it again? Thanks!
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: Scrolling all the way down to a tableview causes a EXC_BAD_ACCESS 1 year, 7 months ago #3

The project that I sent you early was quickly put together to replicate the problem for my first question.
The one where I experiencing the issue of the bad_access is the app that I am about to release.

I can't easily replicate the issue in the sample project because I have to create the tweeter feed.
I will try to simulate with a couple of records and see if happens there. The code that I am using
was working fine with the regular table template that comes with Apple though.

I was trying to replace them because after watching the videos I figured that I could simplify the code
and add more quickly features for everything that involved the tables.
  • amok
  • OFFLINE
  • Fresh Boarder
  • Posts: 8
  • Karma: 0

Re: Scrolling all the way down to a tableview causes a EXC_BAD_ACCESS 1 year, 7 months ago #4

Thanks amok, we will try our best here to replicate the issue and get back to you ASAP.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: Scrolling all the way down to a tableview causes a EXC_BAD_ACCESS 1 year, 7 months ago #5

I have been able to replicate the issue with the sample project that we have exchanged early.
I just sent it on your way.
  • amok
  • OFFLINE
  • Fresh Boarder
  • Posts: 8
  • Karma: 0

Re: Scrolling all the way down to a tableview causes a EXC_BAD_ACCESS 1 year, 7 months ago #6

Thanks a lot amok for sending in your sample project.

The problem actually lies in your code, specifically in the implementation of willDisplayCell:

 
- (void)tableViewModel:(SCTableViewModel *)tableViewModel willDisplayCell:(SCTableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
cell.imageView.image = [UIImage imageNamed:@"crossbones.png"];
NSDictionary *record = [myTweets objectAtIndex:indexPath.row];
//NSLog(@"%@",[record allKeys]);
cell.textLabel.text = [record objectForKey:@"text"];
[record release];
}
 


The problematic line is "[record release]". You must not release "record" as it's owned by myTweets and will get released when myTweets is deallocated. Just removing this line fixes your problem.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72
  • Page:
  • 1
  • 2
Time to create page: 1.71 seconds