Skip to content

Commit

Permalink
GameCenter RoboVM NSArray is immutable, fixes #42 UnsupportedOperatio…
Browse files Browse the repository at this point in the history
…nException
  • Loading branch information
MrStahlfelge committed Nov 20, 2020
1 parent af501e3 commit 9af79ba
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public void invoke(NSArray<GKSavedGame> savedGames, NSError error) {
}

GKSavedGame mySnapshot = null;
final NSArray<GKSavedGame> resolved = new NSArray<>();
final ArrayList<GKSavedGame> resolved = new ArrayList<>();
if (snapshots.isEmpty()) {
responseListener.gsGameStateLoaded(null);
return;
Expand All @@ -283,8 +283,7 @@ public void invoke(NSArray<GKSavedGame> savedGames, NSError error) {
> mySnapshot.getModificationDate().getTimeIntervalSinceReferenceDate())
mySnapshot = snapshots.get(i);
}
for (GKSavedGame snapshot : snapshots)
resolved.add(snapshot);
resolved.addAll(snapshots);
}

mySnapshot.loadData(new VoidBlock2<NSData, NSError>() {
Expand All @@ -293,7 +292,7 @@ public void invoke(NSData data, NSError error) {
if (error == null) {
// if there were conflicts, resolve them now
if (snapshots.size() > 1)
GKLocalPlayer.getLocalPlayer().resolveConflictingSavedGames(resolved, data, null);
GKLocalPlayer.getLocalPlayer().resolveConflictingSavedGames(new NSArray<>(resolved), data, null);
responseListener.gsGameStateLoaded(data.getBytes());
} else {
Gdx.app.log(GAMESERVICE_ID, "Failed to load gamestate: " + error.getCode());
Expand Down

0 comments on commit 9af79ba

Please sign in to comment.