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 1091293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:30:14+00:00 2026-05-16T23:30:14+00:00

I have a class that retrieves data from core data and stores it into

  • 0

I have a class that retrieves data from core data and stores it into a NSMutablearray. It also has a function that returns this array.

datamanager.h:

@interface DataManager : NSObject {

    NSMutableArray *feedItems;
    ...    
}

@property (nonatomic, retain) NSMutableArray *feedItems; 
...

datamanager.m:

...
-(void)loadNews{
    (load data from core data and put it in self.feedItems) 
    ....
}

-(NSMutableArray*)getAllItems{
    return self.feedItems;
}

Now i Have a UIViewController with 2 UIviews (View1 and View2) as IBOutlets. When a button in View1 is clicked it fetches the data from the datamanager class sets it as a NSMutablearray for use for a UItableviewController (tableView1).

After allocating and initializing tableView1 and setting up the Nsmutablearray to populate the table, I add its view as subview to View 2. Now my problem is when I release tableview1 after this procedure I get a EXEC_BAD_ACCESS.

View1 Button IBAction code:

-(void)loadItems{
    if ([[dataManager getAllNews] count] > 0) {
        ItemTableViewController *tableView1 = [[ItemTableViewController alloc] initWithNibName:@"ItemTableViewController" bundle:nil];

        [tableView1 setItemList:[sectionManager getAllItems]];

        for (UIView *view in View2.subviews) {
            [view removeFromSuperview];
        }

        [View2 addSubview:tableView1.view];

        [tableView1 release]; // if this is not released it works properly else EXEC_BAD_ACCESS
    }

}

tableView1 setItemList function:

-(void)setItemList:(NSMutableArray *)list{
    self.ItemList = list; //self.ItemList is a NSMutableArray
}

How do I properly release tableView1? Ive tried autorelease too, still doesn’t work.

  • 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-16T23:30:15+00:00Added an answer on May 16, 2026 at 11:30 pm

    If you are using UIViewController this way, you have to keep your tableView1 retained and then release it later when it is not used anymore. This could be done by placing

    [tableView1.view removeFromSuperview];
    [tableView1 release];
    

    in your dealloc.

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

Sidebar

Related Questions

I have an Activity that retrieves data from a web service. This data is
I have a class that retrieves its memeber (more or less 10 members) from
I have a Class that has a private variable with a public setter/getter function:
I currently have the following code that retrieves data from the database and then
I have a repository ( CustomerRepository ) that retrieves data from the data layer.
I have a database function that retrieves data and then populates a jtable. I
I have three SQL Server databases that a single application retrieves data from. I
i have an gridview that retrieves the data via a datatable like this: protected
I have a Tapestry application, that retrieves data from a form, writes it to
I got this problem. I have a form that retrieves a table data using

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.