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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:12:10+00:00 2026-06-08T03:12:10+00:00

I am somewhat new to iOS 5 singletons and am using a singleton as

  • 0

I am somewhat new to iOS 5 singletons and am using a singleton as documented here:

iOS 5 Singletons

Something like this:

MyManager.h

#import <Foundation/Foundation.h>
@interface MyManager : NSObject

//Data for section 1
@property(nonatomic,copy) NSString * section1a;
@property(nonatomic, assign) NSUInteger section1b;


//Data for section 2
@property(nonatomic,copy) NSString * section2a;
@property(nonatomic, assign) NSUInteger section2b;

+ (id)sharedInstance;
@end

MyManager.m

@implementation MyManager
@synthesize section1a, section1b, section2a; , section2b;

+ (id)sharedInstance
{
    static dispatch_once_t pred = 0;
    __strong static id _sharedObject = nil;
    dispatch_once(&pred, ^{
        _sharedObject = [[self alloc] init]; // or some other init method
    });
    return _sharedObject;
}
@end

So I use it as follows:

MyManager * myManager = [MyManager sharedInstance];
myManager.data = self.data

Is this how you generally use the singleton? Am I missing anything?
Sorry for the basic questions I just want to make sure I am doing it right.

Thanks

  • 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-08T03:12:12+00:00Added an answer on June 8, 2026 at 3:12 am

    You’re doing it right. This is (currently 🙂 the way to go and works fine with ARC enabled, multiple threads etc.

    It isn’t strictly a singleton, as you can alloc more instances of the class, but I don’t think that’s relevant in your case.

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

Sidebar

Related Questions

This is somewhat new territory for me. I'm using MVC3 with SQL CompactEdition version
I am somewhat new to PHP and am running into an issue. Here is
I'm somewhat new to OpenGL. I've used it for extremely simple stuff like rendering
I am somewhat new to R, and i have this piece of code which
So I'm somewhat new to programming and mostly self-taught, so sorry if this question
I'm somewhat new to this and I am under the impression that to draw
I somewhat new to Javascript and I'm stuck on this one item. Can someone
I'm somewhat new to C++ so, I guess this is a very basic question.
I think that Im missing some pieces for this. Im somewhat new to JavaScript
I am somewhat new to android development, this is my first time trying 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.