Note that there are some explanatory texts on larger screens.

plurals
  1. POEXEC_BAD_ACCESS upon re-loading a UIViewController containing a UITableView
    text
    copied!<p>I get an EXEC_BAD_ACCESS when executing the following steps:</p> <p><strong>STEP 1: Click on "Scores" button from a Main Menu:</strong> This Removes the Menu (UIView), and loads the Scores (UIView) which subsequently initiates the process of populating a UITableView with values. No problems here.</p> <pre><code> self.viewController4 = [[ScoresViewController alloc] initWithNibName:@"ScoresViewController" bundle:nil]; [window addSubview:viewController4.view]; [viewController.view removeFromSuperview]; NSLog(@"LOADING SCORES SCREEN"); </code></pre> <p><strong>STEP 2: Click on "menu" button from the Scores Screen:</strong> This Removes the Scores (UIView), and loads the Menu (UIView) again. No problems here.</p> <pre><code>self.viewController = [[MainMenuViewController alloc] initWithNibName:@"MainMenuViewController" bundle:nil]; [window addSubview:viewController.view]; [viewController4.view removeFromSuperview]; NSLog(@"Loading MAIN MENU"); </code></pre> <p><strong>STEP 3: Click on the "Scores" button again from the Main Menu:</strong> Again, this Removes the Menu (UIView), and loads the Scores (UIView) which subsequently initiates the process of populating a UITableView with values. <strong><em>Problematic!</em></strong></p> <p>The application crashes before displaying the Score Screen (UIView). Using the debugger I traced the problem to the single line of code: <strong><em>cell.text = [self->theScoresArray objectAtIndex:indexPath.row];</em></strong> appearing in the below routine:</p> <pre><code> - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [theTable dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; } cell.text = [self-&gt;theScoresArray objectAtIndex:indexPath.row]; return cell; } </code></pre> <p>Could this be a problem with the indexPath object not being properly released the first time? Any insight would be helpful. Thanks for your valuable time.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload