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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:13:50+00:00 2026-06-14T23:13:50+00:00

So it has been my understanding that using init within a method name is

  • 0

So it has been my understanding that using init within a method name is not advisable if that method doesn’t actualize initialize a new instance of the object. However, what is the case for a singleton type class? If I do something like this:

+ (MyClass*) sharedInstance {

    __block MyClass *sharedInstance = nil;
    static dispatch_once_t once_token;
    dispatch_once(&once_token, ^{
        sharedInstance = [[MyClass alloc] init];
    });

    return sharedInstance;
}

And then have another method:

- (void) initializeInstance {
  // Do some stuff
  // Never call the init method
}

Will there be extra retain cycles or other odd ARC behavior if I do this?

  • 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-14T23:13:52+00:00Added an answer on June 14, 2026 at 11:13 pm

    The method -initializeInstance is not a problem. This does not get classified into the init family, so the compiler does not treat it specially. According to the documentation, in order to be classified into the init family, it must meet the following rules:

    1. The first component of the selector must be either init, or must begin with init followed by any character other than a lowercase letter. initializeInstance does not meet this rule.
    2. Furthermore, the init method must return an Obj-C object. initializeInstance does not meet this rule either. I believe if this rule is violated that causes a compile-time error rather than simply not treating the method as init.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It has been my understanding that the using statement in .NET calls an IDisposable
My understanding of the Javascript so far has been that it is a client-side
This has been one of the biggest obstacles in teaching new people ColdFusion. When
I've been using this function to check if a process is running or not.
As you can see in architecture diagram below android platform has been built using
There has been a long standing issue with Firefox not loading font from different
Sorry if this has been discussed somewhere else on stackoverflow (I could not find
I have an application that has so far been in English only. Content encoding
This is obviously a topic that has been discussed many times, however my angle
It has been recommended to me that I investigate Key/Value pair data systems to

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.