开发者

how to get local top 10 highscore from openfeint

this is my coding am used to get local top 10 highscore but , debugging terminated error occurs.

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

selector:-

- (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;

        }

    }
}

this is my console window error:-

*** Terminating app due to uncaught exception 'NSInvalidArg开发者_StackOverflow中文版umentException', reason: '-[Levelone canReceiveCallbacksNow]: unrecognized selector sent to instance 0x6af2070'
*** Call stack at first throw:

terminate called after throwing an instance of 'NSException'


As the error says, the object you are using as the callback delegate for OFHighScoreService does not recognize the selector canReceiveCallbacksNow. As per OpenFeint documentation, your callback must implement the OFCallbackable protocol which defines this. Simply implement the function, e.g. just have it return YES all the time.


OpenFeint only stores the latest qualifying score per player on a given leaderboard. No user would ever appear ranked at more than one slot on a leaderboard.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜