Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5848433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:51:29+00:00 2026-05-22T12:51:29+00:00

This is yet another EXC_BAD_ACCESS question. Although I’ve done my homework and am certain

  • 0

This is yet another EXC_BAD_ACCESS question. Although I’ve done my homework and am certain that I am not over-releasing my NSArray.

So here is a snippet of my code:

tableData = [NSDictionary dictionaryWithJSONString:JSONstring error:&error];
//Collect Information from JSON String into Dictionary. Value returns a mutli 
dimensional NSDictionary. Eg: { value => { value => "null"}, etc }

NSMutableArray *t_info = [[NSMutableArray alloc] init];
for(id theKey in tableData)
{
    NSDictionary *get = [tableData objectForKey:theKey];
    [t_info addObject:get];
    [get release];
} // converting into an NSArray for use in a UITableView

NSLog(@"%@", t_info);
//This returns an Array with the NSDictionary's as an Object in each row. Returns fine

if (tvc == nil)
{
    tvc = [[tableViewController alloc] init]; //Create Table Controller
    tableView.delegate = tvc;
    tableView.dataSource = tvc;
    tvc.tableView = self.tableView;
    tvc.tableData = t_info; //pass our data to the tvc class
    [tvc.tableView reloadData];
}
...

Now in my TableViewController Class:

@implementation tableViewController
@synthesize tableData, tableView;

- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{
    return [tableData count]; //Returns X Amount Fine.
}

- (UITableViewCell *)tableView:(UITableView *)the_tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    NSString *MyIdentifier = [NSString stringWithFormat:@"MyIdentifier"];

    UITableViewCell *cell = [the_tableView dequeueReusableCellWithIdentifier:MyIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease];
    }

    NSLog(@"%@", tableData); //** CRASHES!!**
    cell.textLabel.text = @"This is a test";
    return cell;
}

If I were to comment out that NSLog, it’ll work fine and return “this is a test” on each table row.

This one has really got me stumped, all the articles I have around about this problem is generally related to retain/memory issues.

Also, another important point.
If I were to pass through my original (NSDictionary) tableData from my first class code and run the same script in my tableViewController – I can NSLog the object perfectly fine.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T12:51:30+00:00Added an answer on May 22, 2026 at 12:51 pm

    The only time you need to release an object is if you have explicitly allocated it by way of new, alloc, or copy.

    NSMutableArray *t_info = [[NSMutableArray alloc] init];
    for(id theKey in tableData)
    {
        NSDictionary *get = [tableData objectForKey:theKey];
        [t_info addObject:get];
        [get release];
    }
    

    You shouldn’t be releasing get here. By doing this, you’re releasing the reference that the tableData dictionary is holding onto, which is bad. My guess is that this is what is causing the problem that you’re encountering.

    If I’m not mistaken, the reason why [tableData count] returns the expected value is because the array is still holding onto the references that have been released.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is yet another Unit Testing question. I'm trying to draw knowledge from a
this is yet another .htaccess question. And I already did my literature review. Would
This is yet another MySQL literature question. I asked for some MySQL / DBA
Yet another list-comparing question. List<MyType> list1; List<MyType> list2; I need to check that they
This is not yet particularly programing related but, I am very interested in how
This is a question I have wondered about for quite some time, yet I
I'm not sure if this has been asked or not yet, but how much
I was asked this question during an interview. They're both O(nlogn) and yet most
Haven't seen many Geneva related questions yet, I have posted this question in the
EDIT: Problem solved. This was (yet another) situation where the problem wasn't really where

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.