2011-03-10 3 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

답변

2

오류가 말했듯이, 당신이 OFHighScoreService에 대한 콜백 대리인으로 사용하는 객체는하지 않습니다 선택자 canReceiveCallbacksNow을 인식하십시오. OpenFeint 설명서에 따라 콜백은 이것을 정의하는 OFCallbackable 프로토콜을 구현해야합니다. 단순히 함수를 구현하십시오. 그냥 항상 YES을 반환해야합니다.

+0

당신의 도움에 아주 고마워. 로컬 장치 (top 1)는 하나의 점수 만 표시됩니다. 로컬 장치 플레이어의 톱 10을 원한다. 문제가 뭐니? – Srinivas

0

OpenFeint는 특정 리더 보드에 플레이어 당 최신 정규 스코어 만 저장합니다. 리더 보드에서 두 개 이상의 슬롯에 순위가 표시되는 사용자는 없습니다.