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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:38:45+00:00 2026-06-10T11:38:45+00:00

For the online mode for my game, I am using the context property of

  • 0

For the online mode for my game, I am using the context property of GKScore, and as all devices which support Game Center can update to iOS 5 (which is when the context property was added), I am requiring that the context property is available to play online. However, I am having issues implementing this runtime-check. I was assuming that I could use [GKScore instancesRespondToSelector:@selector(setContext:)] to check its existence, but this returns false on the iOS 5 and 5.1 simulators, as well as for @selector(context). Why on earth is this happening, and what is the cleanest and correct way to perform this check, please?

  • 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-10T11:38:47+00:00Added an answer on June 10, 2026 at 11:38 am

    I can’t fully explain this, but an instantiated object of class GKScore will return YES to repondsToSelector(context), even while the class says it won’t. If no other solution works, construct a GKScore object just to query it.


    I wondered if [[GKScore alloc] init] actually returns an object with type other than GKScore. This can happen.

    GKScore *instantiatedScore = [[GKScore alloc] init]; // Add autorelease if using manual reference counting.
    NSString* className = NSStringFromClass([instantiatedScore class]);
    NSLog(@"instantiatedScore class name = %@", className);
    

    But, it doesn’t, according to this output:

    instantiatedScore class name = GKScore
    

    I wondered if the compiler directives in the GKSCore.h header file might affect this. It defines two properties that are only available in iOS 5.0 or greater: context and shouldSetDefaultLeaderboard. Maybe those compiler directives mean that the class can’t guarantee it will support those two properties.

    Under this hypothesis [GKScore instancesRepondToSelector:@selector(category)] should return YES, but [GKScore instancesRepondToSelector:@selector(shouldSetDefaultLeaderboard)] should return NO.

    GKScore *instantiatedScore = [[GKScore alloc] init]; // Add autorelease if using manual reference counting.
    NSLog(@"GKScore category = %d", [GKScore instancesRespondToSelector:@selector(category)]);
    NSLog(@"instantiatedScore category = %d", [instantiatedScore respondsToSelector:@selector(category)]);
    
    NSLog(@"GKScore context = %d", [GKScore instancesRespondToSelector:@selector(context)]);
    NSLog(@"instantiatedScore context = %d", [instantiatedScore respondsToSelector:@selector(context)]);
    
    NSLog(@"GKScore shouldSetDefaultLeaderboard = %d", [GKScore instancesRespondToSelector:@selector(shouldSetDefaultLeaderboard)]);
    NSLog(@"instantiatedScore shouldSetDefaultLeaderboard = %d", [instantiatedScore respondsToSelector:@selector(shouldSetDefaultLeaderboard)]);
    

    But, the output is weirder than that:

    GKScore category = 0
    instantiatedScore category = 1
    GKScore context = 0
    instantiatedScore context = 1
    GKScore shouldSetDefaultLeaderboard = 1
    instantiatedScore shouldSetDefaultLeaderboard = 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All the examples that I can search online use the App.Config mode of specifying
I'm developing a game with online mode, but it's opensource (SourceForge) and anyone can
The PDF content can be of online as well as offline mode, I need
Are there any beautiful websites published using Emacs' org mode? I followed the online
The online documentation for MS Office 2010 implies the Field List Pane can be
I am trying to extend the legacy code of an online game to provide
i have an app with an On and Off Mode. In Online Mode, i
For my first time using Xcode I was following a tutorial online. I did
I want to build a web application (SaaS) that can work both in Online
i'm currently programming an iPhone game and I would like to create an online

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.