我正在做一些試驗以嘗試瞭解GameKit,並且我製作了一個簡單的遊戲和一個列出我的玩家匹配的界面。我試圖添加在比賽中使用removeWithCompletionHandler:
方法刪除遊戲的功能,但我無法刪除似乎已進入無效狀態的GKTurnBasedMatch
。刪除處於無效狀態的GKTurnBasedMatch
匹配的問題打印一個PO:
$0 = 0x1d590d20 <GKTurnBasedMatch 0x1d590d20 id:858d8257-cc49-4060-b1d8-38c09a929e3c status:Ended message: taken:2013-03-08 18:08:47 +0000 created:2013-03-08 03:24:14 +0000
current:<GKTurnBasedParticipant 0x1d58c020 - id:G:1717956303 (local player) status:Invited outcome:None lastTurn:(null)>
participants:
<GKTurnBasedParticipant 0x1d58bc90 - id:G:1717239488 status:Done outcome:Quit lastTurn:2013-03-08 18:08:47 +0000>
<GKTurnBasedParticipant 0x1d58c020 - id:G:1717956303 (local player) status:Invited outcome:None lastTurn:(null)>
>
這似乎表明,比賽已經結束。然而,其中一位參與者的結果是:無,我認爲文檔認爲這對於已結束的遊戲無效。試圖簡單地刪除遊戲帶給:
The requested operations could not be completed because one or more parameters are invalid.
試圖設置的結果和結束比賽,得到:
The requested operation could not be completed because the session is in an invalid state.
我想也許是因爲本土球員是主動我不能刪除遊戲參加者,但兩者participantQuitInTurnWithOutcome:...
和endTurnWithNextParticipants:...
都給出錯誤:
The requested operation could not be completed because the session is in an invalid state.
爲好。我做錯了什麼,或者我是否創造了一個無法移動的遊戲?
P.S.我也無法通過Game Center提供的界面刪除遊戲,它們在「遊戲結束」部分列出。
Henrik的答案應該可以解決您的問題。您需要調用declineInviteWithCompletionHandler: – 2013-04-22 20:08:22