2013-11-26 35 views
0

我在輪到我的回合遊戲應用程序中遇到麻煩。在Game Center回合比賽結束回合。

使用方法I'm是

GKTurnBasedMatch *currentMatch = [[GCTurnBasedMatchHelper sharedInstance] currentMatch]; 

[currentMatch endTurnWithNextParticipants:p turnTimeout:1000 matchData:data completionHandler:^(NSError *error) { 
      if (error) { 
       NSLog(@"%@", error); 
      } 
     }]; 

這裏p是我的NSArray爲nextParticipants,這是我爲它聲明: 這是

NSArray *p = [[currentMatch.participants reverseObjectEnumerator] allObjects]; 

我的聲明和賦值正在扭轉參與者陣列以獲得球員的轉身順序。 (只有2)

這一切都編譯和運行沒有錯誤,但轉身從來沒有實際傳遞給其他球員!

想想我的P數組是問題我試過傳遞它,而沒有扭轉它產生相同的結果。

有沒有人知道處理這個問題的正確方法?

回答

3

GKTurnBasedMatch *currentMatch = [[GCTurnBasedMatchHelper sharedInstance] currentMatch]; 

GKTurnBasedParticipant *nextPerson = [currentMatch.participants objectAtIndex:((currentIndex + 1) % [currentMatch.participants count])]; 

[currentMatch endTurnWithNextParticipants:[NSArray arrayWithObject:nextPerson] turnTimeout:1000 matchData:matchData completionHandler:^(NSError *error) { 
    if (error) { 
     NSLog(@"%@", error); 
    } 
}]; 
替換代碼
相關問題