Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/114.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 不知道我要做什么才能添加游戏中心排行榜_Ios_Objective C_Sprite Kit_Game Center_Game Center Leaderboard - Fatal编程技术网

Ios 不知道我要做什么才能添加游戏中心排行榜

Ios 不知道我要做什么才能添加游戏中心排行榜,ios,objective-c,sprite-kit,game-center,game-center-leaderboard,Ios,Objective C,Sprite Kit,Game Center,Game Center Leaderboard,我试图添加一个游戏中心排行榜,首先在iTunes Connect上设置,但当我必须用Xcode编写代码时,我不知道我必须做什么。我想用摇动手势打开排行榜,为此,我将在ViewController.m文件中使用以下代码: -(void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event { if(event.subtype == UIEventSubtypeMotionShake) { // Code y

我试图添加一个游戏中心排行榜,首先在iTunes Connect上设置,但当我必须用Xcode编写代码时,我不知道我必须做什么。我想用摇动手势打开排行榜,为此,我将在ViewController.m文件中使用以下代码:

-(void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {
    if(event.subtype == UIEventSubtypeMotionShake) {
       // Code you want to run when the shake began
       }
}
那代码对吗? 还有,有谁能帮我做些什么,让我在摇动时出现在排行榜上

在项目的“功能”选项卡中启用GameCenter 创建一个CenterViewController实例 设置适当的viewState属性 如有必要,设置gameCenterDelegate属性 向VC展示:

GKGameCenterViewController *vc = [GKGameCenterViewController new];
vc.viewState = GKGameCenterViewControllerStateLeaderboards;
vc.gameCenterDelegate = self;
[self presentViewController:vc animated:YES];

我使用了此代码,但会显示消息Game Center Available the player not signed in(游戏中心不可用玩家未登录),之后我无法与屏幕按钮、手势等交互:/check your sandbox settings您还必须使用[[GKLocalPlayer localPlayer]setAuthenticateHandler:]对本地玩家进行身份验证