Updating the matchData in a GKTurnBasedMatch without ending the turn

与世无争的帅哥 提交于 2019-12-04 11:47:24

The following method was added to GKTurnBasedMatch in iOS 6.0 and will do what you need:

- (void)saveCurrentTurnWithMatchData:(NSData *)matchData
                   completionHandler:(void (^)(NSError *error))completionHandler

"Update the match data without advancing the game to another player"

monkeydom

You can call `-

[GKTurnBasedMatch (void)loadMatchDataWithCompletionHandler:(void (^)(NSData *matchData, NSError *error))completionHandler];

as often as you like to get updated matchData. If you want to do incremental moves you also can do -

[GKTunrBasedMatch - (void)endTurnWithNextParticipant:(GKTurnBasedParticipant *)nextParticipant matchData:(NSData *)matchData completionHandler:(void (^)(NSError *error))completionHandler];

with your own participant as next participant. However, you have to loadMatchDataWithCompletionhandler: once again after you submitted your partial move before you are allowed to submit the next move part.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!