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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:09:06+00:00 2026-05-25T23:09:06+00:00

I started to learn and develop for iOS4, so I just skipped the old

  • 0

I started to learn and develop for iOS4, so I just skipped the old ivar declaration convention and started to use pure properties without even declaring ivars. Everything went fine, I even released my first homemade app on the app store. But then at my dev company, guys told me that they are still using old convention and are declaring ivars with underscored names, use properties and synthesize them (see example at the end). They also said that they are using properties only when outside access to ivars is needed, and for inner access they use direct ivars (for custom classes). I was told that they are doing so because they were experiencing some weird leaks, that sometimes appeared when using custom classes and nil’ying their properties in viewDidUnload (because setting nil to properties sometimes didn’t release those ivar objects)

Just wondering why should I bother to use ivar declaration when using properties and synthesize does all the needed stuff. I can even access ivars directly using their names without self in dealloc. So, does anybody got problems with that or many of you still are sticking with the old declaration convention?

@interface ContactModel : NSObject {

  NSString *_firstName;
}

@property (nonatomic, retain) NSString *firstName;

@end

@implementation ContactModel

@synthesize firstName = _firstName;

-(void)dealloc{
  [_firstName release];
  [super dealloc];
}
@end

Should also note, that Apple still uses that old declaration style when generating main app delegate class file and synthesize window=_window. Hm, currently, I’m a little bit confused about what convention should I take, so any ideas are welcome 🙂

  • 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-25T23:09:06+00:00Added an answer on May 25, 2026 at 11:09 pm

    In the modern runtime you don’t need the ivar declaration, but synthesize a=_a is still useful to make a distinction between self.a (accessors) and _a (direct access). If @property/@synthesize was leaking I think we should know it by now.

    AFAIK using ivars instead properties is only useful if you want @protected access (access to subclasses only), or support the old runtime.

    In dealloc you should release the property directly whether you are using ivar declaration and @properties, and optionally you can nil or not.

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

Sidebar

Related Questions

I just started to learn how to use action listeners. To my understanding it
I just started to learn Mono Develop Installed Mono Develop 2.4.1 and trial version
I have just started to learn how to code iOS apps. I have made
I recently started to learn Java programming and we just reach the Java Threads
I have started to learn how to use OOP and have created a user
I recently started to learn how to use openCL to speed up some part
I started to learn MVC and in conjunction want to use the KnockOut.js I
I've just started to learn the long-heard python language. I've been working with C
I've just started to learn python. I'm curious about what are the efficient ways
I have just started to learn Scala. I was looking for something in line

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.