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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:12:32+00:00 2026-05-24T13:12:32+00:00

For learning iOS programming I’m developing an iPhone application for sharing images. The application

  • 0

For learning iOS programming I’m developing an iPhone application for sharing images. The application is the client for a website.

In the method didFinishLaunchingWithOptions I check if the user is already logged in.
If the user isn’t logged in he can still see all parts of the applications but for example he wouldn’t see option button for editing profile, comment on images, etc.

How can I share the logged/or not status throughout all view controllers?

  • 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-24T13:12:33+00:00Added an answer on May 24, 2026 at 1:12 pm

    Update: If giving this advice today, I would say use a shared instance:

    @interface SomeClass: NSObject 
    {
        +(SomeClass *)shared;
    }
    
    @implementation SomeClass
    {
        +(SomeClass *)shared {
            static SomeClass *shared;
            static dispatch_once_t onceToken;
    
            dispatch_once(&onceToken, ^{
                shared = [SomeClass new];
            });
    
            return shared;
        }
    }
    

    Then it is auto-instantiated for you on first use, and available throughout your app:

    [[SomeClass shared] doSomething];
    

    You can use a singleton – a global, shared instance of an object.

    @interface SomeClassSingleton : NSObject {
    
    }
    
    +(SomeClass*)sharedSomeClass;
    +(void)setSharedSomeClass:(SomeClass*)someObject;
    
    @end
    
    @implementation SomeClassSingleton 
    
    static SomeClass* _someObject = nil;
    
    +(SomeClass*)sharedSomeClass
    {
        return _someObject;
    }
    
    +(void)setSharedSomeClass:(SomeClass*)someObject 
    {
        @syncrhonized(self)
        {
            _someObject = someObject;
        }
    }
    
    @end
    

    Then, when you need to access your object in another source file, you import the header file for your singleton in the other header, like you would for any other reference.

    Create a singleton:

    SomeClass* someObject = [[SomeClass alloc] init];
    
    [SomeClassSingleton setSharedSomeClass:someObject]; // write to save your singleton
    

    Use/read a singleton:

    [[SomeClass sharedSomeClass] someSharedClassMessage];
    // OR
    SomeClass* someObject = [SomeClass sharedSomeClass];
    

    Or, you can create a singleton implementation that auto-inits the first time you access it:

    @implementation SomeClassSingleton 
    
    static SomeClass* _someObject = nil;
    
    +(SomeClass*)sharedSomeClass
    {
        @synchronized(self) {
            if (_someObject == nil) {
                _someObject = [[SomeClass alloc] init];
            }
        }       
    
        return _someObject;
    }
    
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing (for learning iOS programming) an application for images-sharing. The wanted layout is
I am learning Objective-C and iOS programming through the terrific iTunesU course posted by
While learning iOS programming from a book, I notice that for long lines of
I'm interested in learning IOS programming but at the moment i do not have
I am learning iOS development in Objective-C, and I have found a lot of
I'm learning to use the NSXMLParser API for the iOS platform and so far
I am learning on my own about writing an interpreter for a programming language,
I'm still learning my way through iOS development and working with Core Data and
I'm currently learning ObjC and Cocoa programming, coming from the Java world. To test
I've been working at learning programming for a while now and I feel that

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.