#import "GameKitHelper.h"
#import "GameConstants.h" @interface GameKitHelper ()
<GKGameCenterControllerDelegate> {
BOOL _gameCenterFeaturesEnabled;
}
@end @implementation GameKitHelper #pragma mark Singleton stuff +(id) sharedGameKitHelper {
static GameKitHelper *sharedGameKitHelper;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedGameKitHelper =
[[GameKitHelper alloc] init];
});
return sharedGameKitHelper;
} #pragma mark Player Authentication -(void) authenticateLocalPlayer { GKLocalPlayer* localPlayer =
[GKLocalPlayer localPlayer]; localPlayer.authenticateHandler =
^(UIViewController *viewController,
NSError *error) { [self setLastError:error]; if ([CCDirector sharedDirector].isPaused)
[[CCDirector sharedDirector] resume]; if (localPlayer.authenticated) {
_gameCenterFeaturesEnabled = YES;
} else if(viewController) {
[[CCDirector sharedDirector] pause];
[self presentViewController:viewController];
} else {
_gameCenterFeaturesEnabled = NO;
}
};
}
@end
#pragma mark Property setters

-(void) setLastError:(NSError*)error {
_lastError = [error copy];
if (_lastError) {
NSLog(@"GameKitHelper ERROR: %@", [[_lastError userInfo]
description]);
}
} #pragma mark UIViewController stuff -(UIViewController*) getRootViewController {
return [UIApplication
sharedApplication].keyWindow.rootViewController;
} -(void)presentViewController:(UIViewController*)vc {
UIViewController* rootVC = [self getRootViewController];
[rootVC presentViewController:vc animated:YES
completion:nil];
}

IOS GameCenter验证登陆的更多相关文章

  1. IOS开发之记录用户登陆状态,ios开发用户登陆

    IOS开发之记录用户登陆状态,ios开发用户登陆 上一篇博客中提到了用CoreData来进行数据的持久化,CoreData的配置和使用步骤还是挺复杂的.但熟悉CoreData的使用流程后,CoreDa ...

  2. 用户登陆状态,ios开发用户登陆

    IOS开发之记录用户登陆状态,ios开发用户登陆 上一篇博客中提到了用CoreData来进行数据的持久 化,CoreData的配置和使用步骤还是挺复杂的.但熟悉CoreData的使用流程后,CoreD ...

  3. session验证登陆- 页面跳转

    用session验证登陆,当用户想访问一个页面时由于没有登录,就跳转到登录页面,登录后跳转到用户请求的页面,在session跳转中传上次请求的页面.  怎么获得这个url值并跳转到该页面呢? 以此跳转 ...

  4. 使用ssh keys实现免验证登陆远程服务

    使用ssh keys实现免验证登陆远程服务========================Created 星期四 10 五月 2018 引言------------------程序员或者服务器运维人员 ...

  5. sqlserver修改为windows验证登陆, 程序的调整

    业务需求, 客户要求sqlserver改为windows验证登陆, sa用户不可用, 程序端如何修改呢? 我在本机做了个测试. 环境: sqlserver2016, springmvc+spring+ ...

  6. iOS GameCenter 接入

    iOS GameCenter  iTunes Connect 设置 首先,申请一个应用程序,不必提交.目地是为了得到Bundle ID.    然后设置一下工程中Info.plist的Bundle i ...

  7. django开发项目实例3--用session是实现简单的登陆、验证登陆和注销功能

    如果你的网页不是纯阅读型的,那么你很有可能希望在用户打开某些界面的时候需要验证用户是否登陆的信息, 虽然django里面有自带的一些user的类,但我看不懂,并且自己实现也不是很难,下面和大家分享一下 ...

  8. android客户端向服务器端验证登陆方法的实现2

    一.在上一篇文章中,我只是提到了其中一种方法来实现登陆 大家可以参见: http://www.apkbus.com/android-45004-1-1.html      android获取web服务 ...

  9. js进阶 14-2 如何用ajax验证登陆状态(这里用load方法)

    js进阶 14-2 如何用ajax验证登陆状态(这里用load方法) 一.总结 一句话总结:$('#test').load('test.php?password=1234560'),这样就get方式提 ...

随机推荐

  1. Codeforces 899 B.Months and Years

    B. Months and Years   time limit per test 1 second memory limit per test 256 megabytes input standar ...

  2. dubbo框架的简单介绍

    以下的官网的介绍. dubbo是SOA.小例子是简单的远程调用(生产者消费者的模式出现).http://blog.csdn.net/huangyekan/article/details/4217267 ...

  3. Wordpress笔记:背景音乐

    想要在blog首页加上自动播放的背景音乐,能找到的插件与方法基本上都是讲在文章里添加的.侧边栏里添加文本的方法也总有美观等等这样那样的问题,折腾了几种之后终于搞定了.用的是Audio player插件 ...

  4. 2016北京集训测试赛(十七)Problem A: crash的游戏

    Solution 相当于要你计算这样一个式子: \[ \sum_{x = 0}^m \left( \begin{array}{} m \\ x \end{array} \right) \left( \ ...

  5. php中int类型在不同平台所占不同字节数理解

    1.在不同平台上占字节数与最大值 在32位平台上int占4个字节,在64位平台上int占8个字节,PHP_INT_SIZE 在32位平台上int的最大值2^31 - 1,在64位平台上int最大值2^ ...

  6. windows 下使用github客户端报错:Failed to publish this branch

    在windows系统下使用github客户端同步的时候报错“Failed to publish this branch”,查找原因,发现结果是安装vscode的时候没有检查到git,然后安装git后库 ...

  7. js中高效拼接字符串

    写在前面 面试的过程,很有可能面试到c#那种方式拼接字符串更高效,然后就会引申到js中的拼接方式.这也是我在面试中遇到的问题,当时,也真没比较过js中到底哪种方式更高效.然后,跟猜测一样,说了使用数组 ...

  8. PHP计算两个时间的年数、月数以及天数

    如何获取两个不同时间相差几年几月几日呢?比如当前时间距离2008年08月08日的北京奥运会有几年几月几日了?需要说明的是:1.定义一年为360天,一个月为30天:2.代码中86400=24*60*60 ...

  9. 深入解析hostname

    结论:/etc/sysconfig/network 确实是hostname的配置文件,hostname的值跟该配置文件中的HOSTNAME有一定的关联关系,但是没有必然关系,hostname的值来自内 ...

  10. 13.【nuxt起步】-部署到正式环境

    已经购买centos服务器,并安装了nodejs环境 Secure CRT链接 Cd / Cd /var/www Mkdir test.abc.cn 用ftp 除了node_modules,其他都上传 ...