# Apple Game Center and Google Play Services support

**URL:** <https://forum.defold.com/t/apple-game-center-and-google-play-services-support/32273>\
**Category:** Questions\
**Created:** [October 17, 2018, 9:57am UTC](https://forum.defold.com/t/apple-game-center-and-google-play-services-support/32273 "2018-10-17T09:57:37Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![paxer](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/paxer/32/3529_2.png) [@paxer](https://forum.defold.com/u/paxer)\
**Post date:** [October 17, 2018, 9:57am UTC](https://forum.defold.com/t/apple-game-center-and-google-play-services-support/32273/1 "2018-10-17T09:57:37Z")

</div>

Hi,

I heard that Defold team is working on native extension for Google Play Services do we have an ETA when it will be available? Also is there a plan to build a native extension for Apple Game Center.

I am particularly interested - how comprehensive support of the native API SDK will be available? Are these native extensions will support not just Leaderboards, Achievements, and Challenges but also multi-player sessions (Turn based and Real-Time Matches)/peer to peer)

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [October 17, 2018, 7:37pm UTC](https://forum.defold.com/t/apple-game-center-and-google-play-services-support/32273/2 "2018-10-17T19:37:43Z")

</div>

> [@paxer](#):
>
> do we have an ETA when it will be available

Nope, no ETA, I’m afraid. The work hasn’t begun yet. I’ve currently looked into a Firebase extension and the next extension I’ll take a look at would be GPGS.

> [@paxer](#):
>
> is there a plan to build a native extension for Apple Game Center

No, not at the moment. You could always implement it yourself if you really need it 🙂

---

<div class="post-metadata">

**Author:** ![AGulev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/agulev/32/4541_2.png) [@AGulev](https://forum.defold.com/u/AGulev)\
**Post date:** [October 17, 2018, 7:46pm UTC](https://forum.defold.com/t/apple-game-center-and-google-play-services-support/32273/3 "2018-10-17T19:46:28Z")

</div>

> [@paxer](#):
>
> Also is there a plan to build a native extension for Apple Game Center.

I didn’t try it, but as I know @Dragosha use it in his game: [GitHub - vinhvd/defoldgamecenter: Defold Game Center native extension · GitHub](https://github.com/vinhvd/defoldgamecenter)

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [October 18, 2018, 4:11am UTC](https://forum.defold.com/t/apple-game-center-and-google-play-services-support/32273/4 "2018-10-18T04:11:06Z")

</div>

Oh, yeah, forgot about that one!

---

<div class="post-metadata">

**Author:** ![Dragosha](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dragosha/32/5103_2.png) [@Dragosha](https://forum.defold.com/u/Dragosha)\
**Post date:** [October 18, 2018, 11:37am UTC](https://forum.defold.com/t/apple-game-center-and-google-play-services-support/32273/5 "2018-10-18T11:37:20Z")

</div>

> [@AGulev](#):
>
> I didn’t try it, but as I know @Dragosha use it in his game: [https://github.com/vinhvd/defoldgamecenter](https://github.com/vinhvd/defoldgamecenter)

a bit improved fork of this lib:

> **[Dropbox](https://www.dropbox.com/sh/mpeo8qobl4616oj/AABXpoL0Igvv_X8M8he3dK9Ya?dl=0)**

now callback returns an alias and playerID

```lua
...
gamecenter.login(login_cb)
...

-- Login callback
local function login_cb(self, data)
	print("Game center logging:")
	if(data.error) then
		print("===>code :" .. data.error.code)
		print("===>message :" .. data.error.message)
	else
		if data.playerID then
			print("Game center initialized with:", data.alias, data.playerID)
            ...
		end
	end
end

```

also I tried to implement saveGame function, but Game Center required iCloud support for this, and I haven’t find good example how do that in pure object-C, all examples was for X-Code. So, I just connect player’s account in PlayFab cloud with his iOS PlayerID and make the save file there.

---

<div class="post-metadata">

**Author:** ![Dragosha](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dragosha/32/5103_2.png) [@Dragosha](https://forum.defold.com/u/Dragosha)\
**Post date:** [February 1, 2019, 12:52pm UTC](https://forum.defold.com/t/apple-game-center-and-google-play-services-support/32273/6 "2019-02-01T12:52:19Z")

</div>

My fork on GitHub is here:

> **[GitHub - Dragosha/defoldgamecenter: Defold Game Center native extension](https://github.com/Dragosha/defoldgamecenter)**
>
> Defold Game Center native extension

Added: alias and playerID within login’s callback data.  
Added: “Try-Catch” constructions in objective-C code to prevent hard crash on devices with turn off Game Center (tested on iPad Pro with iOS 12)

---

<div class="post-metadata">

**Author:** ![totebo](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/totebo/32/36087_2.png) [@totebo](https://forum.defold.com/u/totebo)\
**Post date:** [January 30, 2020, 1:10pm UTC](https://forum.defold.com/t/apple-game-center-and-google-play-services-support/32273/7 "2020-01-30T13:10:46Z")

</div>

I’m trying to gauge the status of Game Center and Google Play support;

**Game Center:** Authentication, leaderboards, achievements with [the extension](https://github.com/Dragosha/extension-gamecenter) mentioned above. @animonger has also started an extension mentioned in [this post](https://forum.defold.com/t/gamekit-and-google-play-services/236/12). Has anyone used Game Center functionality in a live game?

**Google Play:** Authentication and cloud saves with [this extension](https://github.com/defold/extension-gpgs).

Is this right?

After a year or so making HTML5 Facebook Instant games it looks likely that I’ll start using Defold for iTunes and Google Play games soon. Native leaderboards and achievements are likely to be requirements. I can’t add this functionality to Google Play myself, but I could support someone who can with testing and possibly payment too if needed.

---

<div class="post-metadata">

**Author:** ![Dragosha](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dragosha/32/5103_2.png) [@Dragosha](https://forum.defold.com/u/Dragosha)\
**Post date:** [January 30, 2020, 1:24pm UTC](https://forum.defold.com/t/apple-game-center-and-google-play-services-support/32273/8 "2020-01-30T13:24:43Z")

</div>

> [@totebo](#):
>
> Has anyone used Game Center functionality in a live game?

Actual extension repo is here: [GitHub - Dragosha/extension-gamecenter · GitHub](https://github.com/Dragosha/extension-gamecenter)

---

<div class="post-metadata">

**Author:** ![totebo](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/totebo/32/36087_2.png) [@totebo](https://forum.defold.com/u/totebo)\
**Post date:** [January 30, 2020, 1:30pm UTC](https://forum.defold.com/t/apple-game-center-and-google-play-services-support/32273/9 "2020-01-30T13:30:20Z")

</div>

Thanks, updated the link.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [January 30, 2020, 3:16pm UTC](https://forum.defold.com/t/apple-game-center-and-google-play-services-support/32273/10 "2020-01-30T15:16:06Z")

</div>

> [@Dragosha](#):
>
> Actual extension repo is here: [GitHub - Dragosha/extension-gamecenter · GitHub](https://github.com/Dragosha/extension-gamecenter)

You should submit this to the asset portal!

---

<div class="post-metadata">

**Author:** ![totebo](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/totebo/32/36087_2.png) [@totebo](https://forum.defold.com/u/totebo)\
**Post date:** [February 26, 2020, 12:10pm UTC](https://forum.defold.com/t/apple-game-center-and-google-play-services-support/32273/11 "2020-02-26T12:10:12Z")

</div>

I’m looking to save progress to the cloud in an upcoming game. Google Play has support for it with [this extension](https://github.com/defold/extension-gpgs).

For iTunes, the two (lovely) existing extension don’t seem to support cloud saves:

> **[extension-gamecenter](https://dragosha.github.io/extension-gamecenter/)**

[https://github.com/animonger/extension-gamekit](https://github.com/animonger/extension-gamekit)

Have I missed a way to save to the elusive Apple cloud?

---

<div class="post-metadata">

**Author:** ![animonger](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/animonger/32/19118_2.png) [@animonger](https://forum.defold.com/u/animonger)\
**Post date:** [February 26, 2020, 7:41pm UTC](https://forum.defold.com/t/apple-game-center-and-google-play-services-support/32273/12 "2020-02-26T19:41:40Z")

</div>

The code to save game data to iCloud exists in the extension I wrote. Scroll to line 171 [here.](https://github.com/animonger/extension-gamekit/blob/master/gamekit/src/SendCommands.mm)

The Obj-C code I used in the extension is taken directly from the [Apple docs](https://developer.apple.com/documentation/gamekit/gklocalplayer/1520527-savegamedata?language=objc) but it doesn’t work. I posted to the Apple support forums and the only responses I got were from other iOS devs saying they had the same problem or I should try Swift. Apple has not responded to any of my inquiries. I tried for about a month all the workarounds I could think of or find on the internet and they all result in error 27: not logged into iCloud. I tried this with multiple test AppleIDs and my real AppleID with no progress. I suspect that the Obj-C code is broken and Apple no longer cares about supporting it and is focused on Swift moving forward but I have no official word on this.

The functionality is in place for you to test this out for yourself if you download the included test Defold project and set it up on Game Center. If you decide to do this please let me know what your results are.

---

<div class="post-metadata">

**Author:** ![radiofreelunch](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/radiofreelunch/32/19336_2.png) [@radiofreelunch](https://forum.defold.com/u/radiofreelunch)\
**Post date:** [February 26, 2020, 10:33pm UTC](https://forum.defold.com/t/apple-game-center-and-google-play-services-support/32273/13 "2020-02-26T22:33:17Z")

</div>

If your game save is very small, you could probably use iCloud key-value storage (I know `NSUbiquitousKeyValueStore` works fine, I use it to store e.g. Tutorial progress and which tips have been shown). I never tried `GKSavedGame` because I didn’t want to deal with conflicts — can you really just ignore those?

---

<div class="post-metadata">

**Author:** ![animonger](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/animonger/32/19118_2.png) [@animonger](https://forum.defold.com/u/animonger)\
**Post date:** [February 27, 2020, 1:31am UTC](https://forum.defold.com/t/apple-game-center-and-google-play-services-support/32273/14 "2020-02-27T01:31:47Z")

</div>

Thanks for the interesting workaround suggestion.  
Considering you would have to register an Apple identifier for a iCloud Container and add iCloud capabilities to the AppID I think NSUbiquitousKeyValueStore would work better in a separate iCloud native extension. Especially for Defold developers who only want Game Center features like Leaderboards and Achievements. Its too bad GKSavedGame doesn’t work because it has [no specific limit on the amount of data that can be saved.](https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/GameKit_Guide/SavedGames/SavedGames.html)

Which conflicts are you referring to regarding GKSavedGame?

---

<div class="post-metadata">

**Author:** ![radiofreelunch](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/radiofreelunch/32/19336_2.png) [@radiofreelunch](https://forum.defold.com/u/radiofreelunch)\
**Post date:** [February 27, 2020, 1:59am UTC](https://forum.defold.com/t/apple-game-center-and-google-play-services-support/32273/15 "2020-02-27T01:59:29Z")

</div>

True, though I wanted iCloud persistence (so if you play on both your iPhone and your iPad, you don’t have to see the same tutorial tips).

If you do have both an iPhone and iPad, and play the same game (save slot) on both, you are likely to get out of sync if you are ever off a network. This is an iCloud conflict, and needs to be resolved in some fashion (possibly automatically with the more recent save, but ideally by asking the player which device is the truth).

And yes, you are absolutely right about the amount of data. Many games are probably small enough to use `NSUbiquitousKeyValueStore` but if you’re in any doubt, I would avoid it.

---

<div class="post-metadata">

**Author:** ![totebo](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/totebo/32/36087_2.png) [@totebo](https://forum.defold.com/u/totebo)\
**Post date:** [February 27, 2020, 11:14am UTC](https://forum.defold.com/t/apple-game-center-and-google-play-services-support/32273/16 "2020-02-27T11:14:45Z")

</div>

> [@animonger](#):
>
> I suspect that the Obj-C code is broken and Apple no longer cares about supporting it and is focused on Swift moving forward but I have no official word on this.

Wow, that’s not great is it?!

> [@radiofreelunch](#):
>
> If your game save is very small, you could probably use iCloud key-value storage (I know `NSUbiquitousKeyValueStore` works fine, I use it to store e.g. Tutorial progress and which tips have been shown).

Yes, in my case this is likely to be enough. Are you using this in Defold? I couldn’t find a public extension for it?

---

<div class="post-metadata">

**Author:** ![Dragosha](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dragosha/32/5103_2.png) [@Dragosha](https://forum.defold.com/u/Dragosha)\
**Post date:** [February 27, 2020, 3:37pm UTC](https://forum.defold.com/t/apple-game-center-and-google-play-services-support/32273/17 "2020-02-27T15:37:54Z")

</div>

> [@animonger](#):
>
> The Obj-C code I used in the extension is taken directly from the [Apple docs](https://developer.apple.com/documentation/gamekit/gklocalplayer/1520527-savegamedata?language=objc) but it doesn’t work.

as I remember (can be mistake) save/load functional isn’t a part of GameKit now and needs for special permission at the Apple gamesettigs panel (iCloud enabling).

---

<div class="post-metadata">

**Author:** ![radiofreelunch](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/radiofreelunch/32/19336_2.png) [@radiofreelunch](https://forum.defold.com/u/radiofreelunch)\
**Post date:** [February 27, 2020, 4:33pm UTC](https://forum.defold.com/t/apple-game-center-and-google-play-services-support/32273/18 "2020-02-27T16:33:53Z")

</div>

I’m still deciding if I want to use Defold for a future project. I use `NSUbiquitousKeyValueStore` in the iOS version of Six Ages (but not for saving full game state because it’s too large).

I noticed that game save/load was not available for tvOS, which seems like an odd omission. Would this keep you from getting a game on Apple Arcade?

For the record, the simplistic version of Steam cloud saves worked pretty well for Six Ages. In the game, you do nothing at all. The Steam client handles conflict resolution. And it handles Mac and Windows files in different folders. Obviously, it is of no use for mobile.

---

<div class="post-metadata">

**Author:** ![animonger](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/animonger/32/19118_2.png) [@animonger](https://forum.defold.com/u/animonger)\
**Post date:** [February 27, 2020, 6:00pm UTC](https://forum.defold.com/t/apple-game-center-and-google-play-services-support/32273/19 "2020-02-27T18:00:13Z")

</div>

Thanks for the tip! I’ll try adding iCloud capabilities to the AppID identifier and see if that works.

@radiofreelunch Good to know that there are potential syncing issues between iPhone and iPad. Thanks for the info.

@totebo I’ll try @Dragosha fix suggestion this weekend and report back with the results.

---

<div class="post-metadata">

**Author:** ![animonger](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/animonger/32/19118_2.png) [@animonger](https://forum.defold.com/u/animonger)\
**Post date:** [March 9, 2020, 11:15pm UTC](https://forum.defold.com/t/apple-game-center-and-google-play-services-support/32273/20 "2020-03-09T23:15:02Z")

</div>

I’m still working on iCloud capabilities but I’m stuck adding the entitlements in Defold properly. I’ve posted the problem details in this question to the forum: [How to properly add iOS entitlements to an app?](https://forum.defold.com/t/how-to-properly-add-ios-entitlements-to-an-app/64605)

The good news is, I’ve since found out that the Unity Game Center plugins that have the GKSavedGame feature require iCloud capabilities to work. So, when I can get iCloud entitlements added properly it’s looking like Save Game is possible.

[Next page](https://forum.defold.com/t/apple-game-center-and-google-play-services-support/32273.md?page=2)
