2011-03-10 70 views
0

這是我的編碼,用於獲得本地排名前10的高分但是,調試終止錯誤發生。如何從openfeint獲得本地排名前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' 
+0

但只有一個分數顯示本地設備(前1)。我想要本地設備播放器的前10名,最新問題 – Srinivas 2011-03-12 07:29:35

回答

2

由於錯誤說,你正在使用的回調委託對象不識別選擇器canReceiveCallbacksNow。根據OpenFeint文檔,您的回調必須執行定義此的OFCallbackable協議。簡單地實現該功能,例如只要它一直返回YES

+0

非常感謝您的幫助。但只有一個分數顯示本地設備(前1名)。我想要本地設備玩家的前10名,最新的問題是什麼? – Srinivas 2011-03-11 13:01:16

0

OpenFeint只存儲給定排行榜上每個玩家的最新合格分數。沒有用戶會出現在排行榜上超過一個插槽的排名。