#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. Alfred添加百度搜索

    Alfred默认的搜索只有 google; amazon和wikipakia, 我想加个百度搜索,怎么添加呢? 1.首先添加百度搜索,添加http://www.baidu.com/s?wd={quer ...

  2. js链式调用 柯里化

    var d = 1; d.add(2).add(3).add(4) //输出10 写出这个add函数 Number.prototype.add = function(x){ return this + ...

  3. 三、Ubuntu 使用Xshell

    1.下载一个Xshell 2.输入命令:ssh  root@Ubuntu的ip地址 输入密码,即可连接 如果遇到不可连接.在Ubuntu中输入命令 vim /etc/ssh/sshd_config 更 ...

  4. Codeforces Gym101063 C.Sleep Buddies (2016 USP-ICMC)

    C.Sleep Buddies It is nighttime in the Earth Colony on Mars and everyone is getting ready to sleep. ...

  5. HDU 5242 Game(树上贪心)

    题目链接 Game 题目的意思很简单, 就是要找一棵树权值最大等等前K条链. 在本题中,走的次数等于min(叶子结点个数,k) tree[i].sum意为从i号结点出发走到某个叶子结点能得到的最大总价 ...

  6. Unity工程资源破解

        Unity工程资源提取其实还是很方便的,网上也有很多相关介绍,比如雨凇就专门写了一遍关于破解Unity资源的文章(http://www.xuanyusong.com/archives/3618 ...

  7. 10.1综合强化刷题 Day1

    a[问题描述]你是能看到第一题的 friends 呢.——hja何大爷对字符串十分有研究,于是天天出字符串题虐杀 zhx.何大爷今天为字符串定义了新的权值计算方法.一个字符串由小写字母组成,字符串的权 ...

  8. 利用反编译学习Android

    自从2014年底到2015年中,全民创业的热潮就已经席卷全国了,一大批新的创业公司在北上广萌芽,也造成了大量的开发人员需求.扯远了,今天不谈创业潮,聊聊如何通过反编译学习Android.本文只是个人对 ...

  9. 在网页里插入flash的代码

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://down ...

  10. tensorflow 运行 python convolutional.py时

    Traceback (most recent call last): File "convolutional.py", line 326, in <module> tf ...