如何测试游戏中心是否可用?
|
我刚刚在我的应用程序中实现了游戏中心支持,如此处所述,如何使用Game Center教程:第1/2部分制作简单的多人游戏。
它被实现为单例。在我的应用程序委托中:
// At the end of applicationDidFinishLaunching, right before
// the last line that calls runWithScene:
[[GCHelper sharedInstance] authenticateLocalUser];
有关方法和属性的概述:
@interface GCHelper : NSObject {
BOOL gameCenterAvailable;
BOOL userAuthenticated;
}
@property (assign, readonly) BOOL gameCenterAvailable;
+ (GCHelper *)sharedInstance;
- (void) authenticateLocalUser;
@end
由于现在在我的应用程序委托中引用了GCHelper,因此我想知道如何在游戏中心可用的情况下在其他课程(我向其中提交分数)中进行实际测试。
如何在另一个类中获取GCHelper的单例实例?
没有找到相关结果
已邀请:
1 个回复
古擅坛犯
//DataClass.m
现在,在您的视图控制器中,您需要将该方法调用为:
每个视图控制器都可以访问此变量。您只需要创建一个Data类的实例。