SpriteKit中的GKLeaderboard?

时间:2014-11-28 22:51:12

标签: sprite-kit game-center leaderboard game-center-leaderboard

如何在SpriteKit中使用GKLeaderboard?

当我尝试提出排行榜时,我遇到了这个问题。

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setShowsFPS:]: unrecognized selector sent to instance 0x17017fb00'

First throw call stack:
(0x18df0ef50 0x19a4181fc 0x18df13c04 0x18df11930 0x18de315dc 0x100069e00 0x190ed8670 0x190ed83f4 0x190fccd08 0x18df13700 0x18de2ceec 0x1911d5ee4 0x18ed278dc 0x18df13700 0x18de2ceec 0x19a9f0014 0x19a9effd4 0x19a9f31dc 0x18decec2c 0x18deccf6c 0x18de0dc20 0x193af5c0c 0x190f3efdc 0x1000dcb34 0x19aa0baa0)
libc++abi.dylib: terminating with uncaught exception of type NSException**

显示排行榜的方法:

-(void) showLeader
{
    GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
    if (leaderboardController != nil)
    {
        leaderboardController.leaderboardDelegate = self;
        [self presentModalViewController:leaderboardController animated:YES];

    }
}

提前致谢!

1 个答案:

答案 0 :(得分:1)

在iOS 6中不推荐使用presentModalViewController。在iOS 7中不推荐使用GKLeaderbardViewController。

您可以参考:

What should I use instead of deprecated GKLeaderboardViewController in iOS7?