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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:33:13+00:00 2026-05-14T01:33:13+00:00

I got nabbed by the following bug again and would like some clarification to

  • 0

I got nabbed by the following bug again and would like some clarification to exactly why it is a bug.

I have a simple UITableView that loads some data:

// myclass.h
@property (nonatomic, retain) NSArray *myData

// myclass.m
@synthesize myData;

- (void) viewDidLoad {
  ...
  myData = someDataSource // note the lack of self
}

- (UITableViewCell *) cellForRowAtIndexPath ... {
   ...
   cell.textLabel.text = [self.myData objectAtIndex:indexPath.row];  // EXC_BAD_ACCESS
}

The table first loads fine, but when scrolling up enough that one of the cells is totally out of the view I then get the EXC_BAD_ACCESS error.

Am I missing something in regards to @property retain. My understanding is that it releases anything that the pointer was previously pointing to before the reassignment. If I am correct then why would not using self. cause any problems?

Thanks for the help.

**** Update

Why is is that in all the examples that I have checked with to the release of objects within the dealloc method without the self?

- (void) dealloc { 
  [someArray release]; 
  [someTableView release];
}
  • 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-14T01:33:14+00:00Added an answer on May 14, 2026 at 1:33 am

    If you don’t use self., you are directly assigning to the instance variable myData, which has nothing to do with the property myData.

    self.myData is just syntactic sugar for [self myData] or [self setMyData:newValue], and the synthesized property just creates the -myData and -setMyData: methods.

    The instance variable is just a variable, nothing more. While it may have the same name, assigning to it or reading from it it is just like accessing any variable: nothing is retained, released, or in other ways modified besides the assignment.

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

Sidebar

Related Questions

Got a bit of a mind freeze at the moment. I have the following
Got some code that is not mine and its producing this warning atm: iehtmlwin.cpp(264)
Got a real simple question but can't figure out the solution. Got following code.
Got something like this <div class=something> <div></div> <p> Some text here </p> </div> This
Got a situation where we have a working production website that is moving to
Got an application wich read some infos in a specific XML file. I would
Got some code here that isn't working: $(#sidebar ul li:last).each(function(){ $(this).addClass(last); }); Basically I
Got a class that serializes into xml with XMLEncoder nicely with all the variables
Got a task to make a program that registers animals and the object is
Got a slight problem trying to have jquery UI and knockout js to cohoperate.

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.