0

这是我用来获得本地前 10 名高分的编码,但是会出现调试终止错误。

[OFHighScoreService getPageWithLoggedInUserForLeaderboard: theLeaderboardID onSuccess:OFDelegate(self, @selector(_scoresDownloaded:))
        onFailure:OFDelegate()];

选择器:-

- (void)_scoresDownloaded:(OFPaginatedSeries*)page
{

    NSMutableArray* highscores = nil;

    if ([page count] > 0)
    {
        if ([[page objectAtIndex:0] isKindOfClass:[OFTableSectionDescription class]])
        {
            highscores = [(OFTableSectionDescription*)[page objectAtIndex:0] page].objects;
        }
        else
        {
            highscores = page.objects;
        }
    }
   NSString *userID = [OpenFeint lastLoggedInUserName];
    for (OFHighScore* score in highscores)
    {
        ccColor3B theColor = ccBLACK;
        if ([score.user.name isEqualToString: userID] ) {
            //score now contains the users data... Do what I want with it.
                        NSLog(@"%d %@ %d", score.rank, score.user.name, score.score);
                        break;

        }

    }
}

这是我的控制台窗口错误:-

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Levelone canReceiveCallbacksNow]: unrecognized selector sent to instance 0x6af2070'
*** Call stack at first throw:

terminate called after throwing an instance of 'NSException'
4

2 回答 2

2

正如错误所说,您用作回调委托的对象OFHighScoreService无法识别选择器canReceiveCallbacksNow。根据 OpenFeint 文档,您的回调必须实现OFCallbackable定义它的协议。只需实现该功能,例如让它一直返回YES

于 2011-03-11T12:18:37.617 回答
0

OpenFeint 仅在给定排行榜上存储每位玩家的最新排位赛得分。任何用户都不会出现在排行榜上超过一个位置的排名。

于 2011-04-05T17:22:17.707 回答