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

  • Home
  • SEARCH
  • 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 8807899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:28:56+00:00 2026-06-14T02:28:56+00:00

Possible Duplicate: Should I refer to self.property in the init method with ARC? I’m

  • 0

Possible Duplicate:
Should I refer to self.property in the init method with ARC?

I’m new to Objective-C and still trying to get my head around everything that’s different (from C# and C). I’m using ARC in my project.

Say I’ve got a constructor like so:

-(id)initWithPriority:(NSNumber *)x1 Value:(id)y1

and I’ve got two (strong) (synthesized) properties (x2,y2). If I do:

_x2=x1;
_y2=y1;

(which skips going through the property and just access the synthesized ivars) rather than

x2=x1;
y2=y1;

does ARC still function (like does it still keep a retain count thingy)?

  • 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-06-14T02:28:57+00:00Added an answer on June 14, 2026 at 2:28 am

    ARC operates on assignment; otherwise it would be purposeless. (If it had to operate only through properties, it wouldn’t add anything to what existed before ARC.) So yes, if you assign directly to the ivar, the assigned value is retained automatically.

    And you should assign directly to the ivar if it is your ivar, because during init..., your object is not yet completely state-ready. So, in init..., perform any assignments to your ivars directly to the ivars; do not use the accessors / properties. Example:

    - (id) initWithName: (NSString*) s { 
        self = [super init]; 
        if (self) {
            self->_name = [s copy]; //
        }
        return self; }
    

    However, you can assign to your superclass’s properties. So if this were a UIViewController subclass, assigning to self.title is fine.

    For a complete explanation of how ARC works, see my book:

    http://www.apeth.com/iOSBook/ch12.html

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

Sidebar

Related Questions

Possible Duplicate: Should IBOutlets be strong or weak under ARC? In the documentation, I
Possible Duplicate: Should I Create a New Delegate Instance? Hi, I've tried searching for
Possible Duplicate: Should I Use self Keyword (Properties) In The Implementation? Say I have
Possible Duplicate: How to reference another property in java.util.Properties? I want to refer to
Possible Duplicate: When should I use the new keyword in C++? When should I
Possible Duplicate: Should I always use accessors for instance variables in Objective-C? Lets suppose
Possible Duplicate: Should I use != or <> for not equal in TSQL? Behavior
Possible Duplicate: Should Usings be inside or outside the namespace sa1200 All using directives
Possible Duplicate: Should C++ eliminate header files? In languages like C# and Java there
Possible Duplicate: Should PHP 'Notices' be reported and fixed? Till date i was ignoring

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.