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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:32:35+00:00 2026-05-22T16:32:35+00:00

I am developing an iPhone app and I have a problem accessing to one

  • 0

I am developing an iPhone app and I have a problem accessing to one NSArray defined on delegate.

My app has two tabs. These two tabs have an UITableView. I have the source of the data of these tables on one NSArray defined in the delegate.

When I load the application, the first tab loads correctly all the content. This is one part of code of the first tab controller:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    // Return the number of rows in the section.
    mainAppDelegate *delegate = [[UIApplication sharedApplication]delegate];
    return [delegate.dataArray count];
}

When the debugger is on return statement, I can see that dataArray has 9 elements. The code works fine.

When I click on the second tab, the same code is executed in the second’s tab controller. But while debugger is on return statement, I can see that delegate is not null and dataArray shows

{(int)[$VAR count]} objects

On next step, program crashes giving EXC_BAD_ACCESS

I think in this point dataArray has been released, but I don’t know when. I have deleted dataArray release calls on dealloc functions.

This is the property definition of dataArray:

@property (nonatomic, retain) NSArray *dataArray;

Anyone has any idea? I’m completely lost on it. Thanks for your help!

  • 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-22T16:32:35+00:00Added an answer on May 22, 2026 at 4:32 pm

    As per your comment, you initialize your array like this:

     dataArray = [dict objectForKey:@"data"];
    

    This does not retain the array since you are accessing the ivar directly, not the property. You should do this instead:

    self.dataArray = [dict objectForKey:@"data"];
    

    Some programmers prefer to synthesize their properties with a different ivar name to avoid such mistakes.

    @synthesize dataArray = dataArray_;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing native iPhone app. I have one requirement that, there are 5
im new with objective-c. I have problem with memory leaking when developing iphone app.
I am developing an iPhone app, and I am the following problem. I have
I'm developing an iPhone app and have a question about memory management. Let's say
I'm developing an iPhone app that features a tab-bar based navigation with five tabs.
I'm developing an iPhone app that has a network component. I'm developing the app
Ok guys I am developing an iPhone app I have a Model class which
I'm developing an iPhone app and have a cell object. UITableViewCell *cell = [myTableView
I have been developing an iPhone app and now I am trying to build
I am developing an app for iphone/ipad that I have some problems with. I

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.