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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:33:20+00:00 2026-05-22T16:33:20+00:00

I just implemented game center support in my app like it’s described here How

  • 0

I just implemented game center support in my app like it’s described here How To Make A Simple Multiplayer Game with Game Center Tutorial: Part 1/2.

It is realized as a singleton. In my app delegate:

    // At the end of applicationDidFinishLaunching, right before 
    // the last line that calls runWithScene:
    [[GCHelper sharedInstance] authenticateLocalUser];

A little overview over the methods and attributes:

@interface GCHelper : NSObject {
    BOOL gameCenterAvailable;
    BOOL userAuthenticated;
}

@property (assign, readonly) BOOL gameCenterAvailable;

+ (GCHelper *)sharedInstance;
- (void) authenticateLocalUser;

@end

Since there is now reference to the GCHelper in my app delegate I wonder how to actually test in an other class (where I submit score) if game center is available.

How do I get the singleton instance of GCHelper in another class?

  • 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-22T16:33:21+00:00Added an answer on May 22, 2026 at 4:33 pm

    Just see how I get the instance of singleton class in another class :

    //DataClass.h

    @interface DataClass : NSObject {    
    
    int i;   
    
    }    
    @property(nonatomic,assign)int i;    
    +(DataClass*)getInstance;    
    @end  
    

    //DataClass.m

    @implementation DataClass    
    @synthesize i;    
    static DataClass *instance =nil;    
    +(DataClass *)getInstance    
    {    
    @synchronized(self)    
    {    
        if(instance==nil)    
    {    
    
        instance= [DataClass new];    
    }    
    }    
    return instance;    
    }    
    

    Now in your view controller you need to call this method as :

    DataClass *obj=[DataClass getInstance];  
    obj.i= // whatever you want;  
    

    This variable will be accessible to every view controller. You just have to create an instance of Data class.

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

Sidebar

Related Questions

I just implemented uploadify in my project, and I noticed what seems like an
I have just implemented WMD for my editor in an ASP.NET app. The problem
I am developing a Silverlight app using VS2008 Express. I have just implemented a
I've implemented a simple calendar (message system) for my game which consists from: 1)
I'm creating game mario like in win32 GDI . I've implemented the new loop
I implemented the simple webview app through android to point to an html file
I developed a board game app (for android/iphone) and added a multiplayer component to
I've just implemented a very rudimentary game of tetris in python using pygame and
I intend to make a simple flash game where you're basically a ball rolling
My project for this summer is to make a multiplayer online flash game. I

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.