在Apple的Game Center文档中,它说使用此代码来检测Game Center是否可用:
+ (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);
}
但是它在没有Game Center的iPhone 3G上返回YES。有人解决了这个问题吗?
最佳答案
实际上,您可以检查您的应用程序是否可以打开以下游戏中心之一:URL方案。
BOOL canOpenGC = [[UIApplication sharedApplication] canOpenURL:[NSURL urlWithString:@"gamecenter:/me/account]];
See this StackOverflow answer on the matter
关于iphone - 如何检测Game Center支持?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3858303/