Question

In Apples documentation for Game Center it says to use this code to detect if Game Center is available:

+ (BOOL) isGameCenterAvailable {
  Class gcClass = (NSClassFromString(@"GKLocalPlayer"));

  NSString *reqSysVer = @"4.1";
  NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
  BOOL osVersionSupported = ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending);

  return (gcClass && osVersionSupported);
}

But it returns YES on my iPhone 3G which doesn't have Game Center. Anyone out there who has solved this?

Was it helpful?

Solution 3

The answer is that you can't. Apple wants us to attempt to login to see if Game Center is there. Odd, but that's how it is.

OTHER TIPS

Actually, you can check if your application can open one of the gamecenter: URL schemes.

BOOL canOpenGC = [[UIApplication sharedApplication] canOpenURL:[NSURL urlWithString:@"gamecenter:/me/account]];

See this StackOverflow answer on the matter

I have not tried this, but try getting the local player singleton:

if (![gcClass localPlayer]) {
    // then you havnt got game center support
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top