Create apps that allow players to interact with each other using GameKit.

GameKit Documentation

Post

Replies

Boosts

Views

Activity

Transferring Apps with iCloud KVS
Hi All! I'm being asked to migrate an app which utilizes iCloud KVS (Key Value Storage). This ability is a new-ish feature, and the documentation about this is sparse [1]. Honestly, the entire documentation about the new iCloud transfer functionality seems to be missing. Same with Game Center / GameKit. While the docs say that it should work, I'd like to understand the process in more detail. Has anyone migrated an iCloud KVS app? What happens after the transfer goes through, but before the first release? Do I need to do anything special? I see that the Entitlements file has the TeamID in the Key Value store - is that fine? <key>com.apple.developer.ubiquity-kvstore-identifier</key> <string>$(TeamIdentifierPrefix)$(CFBundleIdentifier)</string> Can someone please share their experience? Thank you! [1] https://developer.apple.com/help/app-store-connect/transfer-an-app/overview-of-app-transfer
3
0
1.3k
May ’23
Error "No Apple native plug-in libraries found." when importing freshly built plugins into Unity
I just built Core and GameKit without errors. The command line I used was the following: python3 build.py -p Core GameKit -m macOS -c "Apple Development ID (redacted)" When importing these packages into Unity, as soon as the editor refreshes I get these errors: DllNotFoundException: GameKitWrapper assembly:<unknown assembly> type:<unknown type> member:(null) And DllNotFoundException: AppleCoreNativeMac assembly:<unknown assembly> type:<unknown type> member:(null) And Apple Unity Plug-ins] No Apple native plug-in libraries found. Were the libraries built with the build script (build.py), xcodebuild, or Xcode? Was any output generated from the build script/tool? Were there any errors or issues? Please check to ensure that libraries (.a, .framework, or .bundle files) were created and saved to each plug-in's "NativeLibraries~" folder. I made sure that the libraries were saved to this NativeLibraries folder. I made sure to update xcode, python, npm and Unity to the latest version, got the most recent commity from Github (Sept. 17th) but the errors persist. The errors also occur right as the game starts in a built player. Also occurs in a blank Unity project, where I tested both 2022.3.17f and 2022.3.48f. The versions I was trying to import was Core 3.1.4 and GameKit 3.0.0. Same issue with Core 3.1.3 and Gamekit 2.2.2. Last version I tried that works was Core 1.05 and GameKit 1.04. I haven't seen anyone else encounter this on these forums so I'm guessing that I'm personally doing something wrong rather than there being an issue with the plugins themselves, but what am I doing wrong?
2
0
143
2d
Leaderboard not updating immediately after submitting score via GameKit API
Hello, I’m working with the GameKit API, and I am encountering an issue when submitting a player’s score to a leaderboard at the end of a game. Goal: After submitting the new score to a leaderboard, I want to immediately fetch and display the updated leaderboard that reflects the new score. Problem: After successfully submitting the player’s score, when I fetch the leaderboard, the entries are not updated right away. The fetched leaderboard still shows the outdated player score. Is this delay in updating the leaderboard expected behavior, or am I missing something in my implementation? Steps to Reproduce: Submit the local player’s score to Leaderboard X. On successful submission, fetch the leaderboard entries for Leaderboard X. Expected Result: The fetched leaderboard should reflect the updated player score immediately. Actual Result: The fetched leaderboard shows the outdated score, with no immediate update. As a workaround, I update the leaderboard myself locally, that does the job, but is error-prone and require more efforts.
2
0
178
2w
Setting a timeout in GKTurnBasedMatch doesn't work... GKTurnBasedParticipant.timeoutDate is always nil.
I have created a turn based game using GameKit. Everything is pretty much done, last thing left to do is the turn time out. I am passing GKTurnTimeoutDefault into the timeout argument in: func endTurn(withNextParticipants nextParticipants: [GKTurnBasedParticipant], turnTimeout timeout: TimeInterval, match matchData: Data) However when I check the .timeoutDate property of the GKTurnBasedParticipant participants, the value is always nil. What am I doing wrong? Am I checking the right property or is there another one instead that I don't know about? I have tried passing different values to the timeout parameter but the timeoutDate is always nil. Has anyone successfully implemented a timeout using GKTurnBasedMatch ?
0
0
171
2w
Leaderboard/achievements and testing
Hi, I created a leaderboard in my application, and a method to record a new score: GKLeaderboard.loadLeaderboards(IDs: [leaderboardID]) { (leaderboards, error) in if let error = error { print("Error loading leaderboards: \(error.localizedDescription)") } guard let leaderboard = leaderboards?.first else { print("Leaderboard not found") return } leaderboard.submitScore(score, context: 0, player: self.localPlayer) { error in if let error = error { print("Error reporting score: \(error.localizedDescription)") } else { print("Score reported successfully!") } } } } When debuging, this method is correctly called and I have a success, so I tried to test it with an internal TestFlight release. The leaderboard is never updated. Is there a way to perform a test of a leaderboard before publishing the app? I have the same question for achievements: let achievement = GKAchievement(identifier: identifier) achievement.percentComplete = percentComplete GKAchievement.report([achievement]) { error in if let error = error { print("Error reporting achievement: \(error.localizedDescription)") } } } Thanks!
2
0
302
4w
GameCenter scores are not being posted to the leaderboard
Hello! Bare with me here, as there is a lot to explain! I am working on implementing a Game Center high score leaderboard into my game. I have looked around for examples of how to properly implement this code, but have come up short on finding much material. Therefore, I have tried implementing it myself based off information I found on apples documentation. Long story short, I am getting success printed when I update my score, but no scores are actually being posted (or at-least no scores are showing up on the Game Center leaderboard when opened). Before I show the code, one thing I have questioned is the fact that this game is still in development. In AppStoreConnect, the status of the leaderboard is "Not Live". Does this affect scores being posted? Onto the code. I have created a GameCenter class which handles getting the leaderboards and posting scores to a specific leaderboard. I will post the code in whole, and will discuss below what is happening. PLEASE VIEW ATTACHED TEXT TO SEE THE GAMECENTER CLASS! GameCenter class - https://developer.apple.com/forums/content/attachment/0dd6dca8-8131-44c8-b928-77b3578bd970 In a different GameScene, once the game is over, I request to post a new high score to Game Center with this line of code: GameCenter.shared.submitScore(id: GameCenterLeaderboards.HighScore.rawValue) Now onto the logic of my code. For the longest time I struggled to figure out how to submit a score. I figured out that in Xcode 12, they deprecated a lot of functions that previously worked for me. Not is seems that we have to load all leaderboards (or the ones we want). That is the purpose behind the leaderboards private variable in the Game Center class. On the start up of the app, I call authenticate player. Once this callback is reached, I call loadLeaderboards which will load the leaderboards for each string id in an enum that I have elsewhere. Each of these leaderboards will be created as a Leaderboard object, and saved in the private leaderboard array. This is so I have access to these leaderboards later when I want to submit a score. Once the game is over, I am calling submitScore with the leaderboard id I want to post to. Right now, I only have a high score, but in the future I may add a parameter to this with the value so it works for other leaderboards as well. Therefore, no value is passed in since I am pulling from local storage which holds the high score. submitScore will get the leaderboard from the private leaderboard array that has the same id as the one passed in. Once I get the correct leaderboard, I submit a score to that leaderboard. Once the callback is hit, I receive the output "Successfully submitted score to leaderboard". This looks promising, except for the fact that no score is actually posted. At startup, I am calling updatePlayerHighScore, which is not complete - but for the purpose of my point, retrieves the high score of the player from the leaderboard and is printing it out to the console. It is printing out (0), meaning that no score was posted. The last thing I have questions about is the context when submitting a score. According to the documentation, this seems to just be metadata that GameCenter does not care about, but rather something the developer can use. Therefore, I think I can cross this off as causing the problem. I believe I implemented this correctly, but for some reason, nothing is posting to the leaderboard. This was ALOT, but I wanted to make sure I got all my thoughts down. Any help on why this is NOT posting would be awesome! Thanks so much! Mark
7
1
3.9k
Dec ’20
Game Center Notifications do not include GKMessageImage.png
Hello, Asking the following as, I was unable to find answers via search on the forum and in the documentation: Invitations sent via iMessage seem to work correctly with my custom image ( GKMessageImage.png ) however, notifications sent to Game Center Friends via invites generated in Game Center do not include the custom image ( GKMessageImage.png ). Questions: Is this expected behavior? Is there a different way to customize the image in the notification? Note the Game Center notification includes the App name correctly. I also noted in the WWDC session in 2016 ( saw video recently ) that there was some mention of no longer adding friends via Game Center. Is that currently true? Thanks in advance.
1
0
358
Jul ’24
Is anyone still using GKVoiceChat since it has been deprecated?
Hello, I would like to know if anyone has or still using the GKVoiceChat capabilities in their apps. I wanted to use it for my online game but I am coming across issues using it and wondering if their are alternatives?. The documentation mentions to use Share-play but that wont be possible with random online players. Any help will be appreciated!.
2
0
356
Aug ’24
GameKit/GameCenter the invitation process gets stuck on “Retrieving”
Hello, I try to invite a friend to play my app , however when the friend try to press invite link component via iMessage, it shows “Retrieving” and then disappear, nothing happens, it doesn't redirect to my app, what I'm missing? or doing wrong I can leave some part of my code import Foundation import GameKit extension RealTimeGame: GKLocalPlayerListener { /// Handles when the local player sends requests to start a match with other players. func player(_ player: GKPlayer, didRequestMatchWithRecipients recipientPlayers: [GKPlayer]) { print("\n\nSending invites to other players.") } /// Presents the matchmaker interface when the local player accepts an invitation from another player. func player(_ player: GKPlayer, didAccept invite: GKInvite) { // Present the matchmaker view controller in the invitation state. if let viewController = GKMatchmakerViewController(invite: invite) { viewController.matchmakerDelegate = self rootViewController?.present(viewController, animated: true) { } } } } also I don't have "<key>CFBundleURLTypes</key>" in my info.plist, I don't know I need that or not...
1
0
278
Aug ’24
Why is the GameController framework loaded
Why is the GameController framework loaded I am checking the launch time of our app, using Instruments->App launch I was confused to find the GameConroller framework loaded I check the project, in the plist file, no configuration GCSupportedGameControllers, GCSupportsControllerUserInteraction related key. What else causes the GameController framework to load?
0
0
242
Aug ’24
Unity Apple Plugin GameKit Error 37 when sending build to app review
I'm using the Apple Unity Plugins to use Game Center to authenticate Playfab accounts for my game and when I test this on testflight, everything works fine for me and the people I've tested with, however, when I send the build to review, they are getting GameKitException 37 which states "This game is not listed in a marketplace that supports Game Center" and upon further research I found this page https://developer.apple.com/documentation/gamekit/gkerror/code/appunlisted which I'm assuming is the same thing. This seems to suggest that I need my app to be listed on the App Store which is strange because this has created a what comes first, the chicken or the egg problem. I need to pass review to get the game listed in the App Store and they can't test the game because accounts cannot be authenticated with Game Center which apparently needs to be listed on the App Store. So far, I can't find the reason why this doesn't happen on testflight and only happens when I send it to review. I opened a ticket to Apple Developer Support and haven't recieved a response. I asked app review about it and they replied "Hello, Thank you for your response. Since all apps must pass App Review before they can be approved, it should not be necessary to have a "store page". We look forward to reviewing your app once all issues have been addressed and the new build has been received and queued for review. Best regards, App Review" Which doesn't really help me. I am quite pressed for time and I really need assistance in resolving this issue which I cannot replicate. Has anyone encountered this issue or know how to solve it?
5
1
1.1k
Jun ’24
GameKit Access Point causes camera background image in ARKit to be black in iOS 18 beta only
I have an AR game using ARKit with SceneKit that works just fine in iOS 17. In the iOS 18 betas, the AR background image shows black instead of showing the real world. As a result there's no tracking and obviously the whole game is useless. I narrowed down the issue to showing the Game Center Access Point. My app has ViewController 1 (VC1) showing the main menu and that's where I want to show the GC Access Point. From there you open VC2 which shows a list of levels. Selecting any level will open VC3 which has the ARScene. Following is the code I use to start Game Center in VC1: GKLocalPlayer.local.authenticateHandler = { gcAuthVC, error in let isGameCenterReady = (gcAuthVC == nil) && (error == nil) if let viewController = gcAuthVC { self.present (viewController, animated: true, completion: nil) } if error != nil { print(error?.localizedDescription ?? "") } if isGameCenterReady { GKAccessPoint.shared.location = .topLeading GKAccessPoint.shared.showHighlights = true GKAccessPoint.shared.isActive = true } } When switching to VC2 I run GKAccessPoint.shared.isActive = false so that the Access Point will no longer show in any of the following VCs. I tried running it in VC1, VC2, and again in VC3 - it doesn't change anything. Once I reach VC3, the background is black. If in VC1 I don't run GKAccessPoint.shared.isActive = true, so I don't activate the access point, the behavior is as follows: If I wait until after the Game Center login animation completes and closes on its own and then I proceed to VC2 and VC3, the camera image will show correctly If I quickly move to VC2 before the Game Center login animation has completed, so my code will close it by setting active = false, and then I continue to VC3, I will see the black background problem. So it does look like activating the access point and then de-activating it causes the issue. BTW, if I activate the access point and leave it on in all VCs, the same black background issue persists. Other than that, when I'm in VC3 with the black background and I switch to another app (so my game moves to the background), when it returns to the foreground, the camera suddenly shows the real world correctly! I tried to manually reset the AR session by pausing and restarting it, but that didn't change anything. Also, when I check with the debugger, it looks like when the app comes back to the foreground it also doesn't run the session start code. But something does seem to reset itself so I wonder what that is. Maybe I could trigger the same manually in my cdoe??? I repeat that everything works just fine in iOS 17 and below. This problem only started with the iOS 18 beta (currently on beta 5, but it started in some of the previous betas as well). So could this be a bug in iOS 18? As a workaround I could check the iOS version and if it's iOS18 not activate the access point, hoping that the user will not jump to VC2 too quickly, and show my own button which will open Game Center. But I'd rather give the users the full experience with their own avatar and the highlights showing up. Plus, certainly some users will move quickly to VC2 and that will be an awful experience. Any help would be greatly appreciated. Thanks!
2
0
352
Aug ’24
Display number of players online for online matchmaking(GameKit)?
Hello, has anyone been able to implement in their game a way to display the number of players currently online in their game?. I thought up of this feature and thought it will be useful for players to find out if there is anyone currently online so that they don't waste their time trying to find a random online match. Any help will be greatly appreciated. Kind regards, Jabir Abdi
1
1
327
Aug ’24
Game Center leaderboard works on TestFlight not on live app
I have a VisionOS app that uses a Game Center Leaderboard. On 'appear' of my content view, I check authentication, and if the user is auth'd, I display a 'leaderboard' button. This works on development / TestFlight – the little floating 'Game Center logged-in' pop up shows up when the app runs, and the button appears. Tapping the button opens the leaderboard, and I can tap over to 'global' and see everyone's scores. However, the app launched today on the App Store, and I'm having some issues. The leaderboard button isn't showing up, meaning that the auth call is probably failing silently. Not sure why. If I log out of Game Center on the device, and re-open the app, I'm able to auth and see my leaderboard button. Once I've done that, the leaderboard seems busted. On App Store Connect I can see the values that I expect (high scores from my beta test flight). But, on the production app, the leaderboard is just empty. And there's no 'global' tab to tap on. Wondering if this is a propagation issue? Like, does it take time to roll out the Game Center entitlements when the app is live? I'm going to distribute promo codes to try and get some more people with the App Store version testing for me to see what happens for them. Any help appreciated!
1
1
623
Jun ’24
Open Leaderboard using Apple Unity Plugin GameKit
This may be a bit dumb but I've really been having trouble with understanding the documentation for Apple's Unity Plugins. I wanted to implement Game Center functionality on my game. So far the only line of code I've managed to get working is the authentication, in which I did async void Start() { await Login(); } public async Task Login() { if (!GKLocalPlayer.Local.IsAuthenticated) { var player = await GKLocalPlayer.Authenticate(); var localPlayer = GKLocalPlayer.Local; ] } However, I'm at a complete loss as to how to open leaderboards. I followed the documentation given: void OpenLeaderboard() { var allLeaderboards = await GKLeaderboard.LoadLeaderboards(); var filteredLeaderboards = await GKLeaderboard.LoadLeaderboards("leaderboardIwant1"); } But it did not work. What did I do wrong? Am I missing a function to get it to work? Why can't Apple write proper documentation to properly implement this in a simple way? My apologies for my frustration. Up until now I've used another plugin from the Unity Asset Store which is shockingly easy to use, but I decided to attempt to use Apple's system because the plugin I had used deprecated functions and I was afraid the App Store would not approve it. But Apple's own plugins are stunningly opaque and hard to test. As additional questions (but not the main ones), I'm also completely at a loss how to submit scores or load specific leaderboards and Apple's documentation does nothing to help there either. Any help or thoughts are appreciated. Thanks.
0
0
299
Jul ’24
GKMatchmaker suddenly not able to connect to players
In the last several days I've gotten reports from customers saying that Game Center suddenly cannot connect to players. I was able to verify this myself. It will find players to match, but then during the Connecting process it just sits there indefinitely with a spinning thing. Up until maybe 4 days ago this had worked fine for the last 12+ years, so something on the Game Center server broke. Is anyone else experiencing the same problem?
2
0
363
Jul ’24
Cannot get Nintendo Switch Joycon accelerator motion data in iOS 16
Now I am using iOS 16 beta 6, I can get buttonA/buttonB is pressed event. but cannot get accelerator motion data info.      //work     buttonA?.valueChangedHandler = {(_ button: GCControllerButtonInput, _ value: Float, _ pressed: Bool) -> Void in       print(">>> ButtonA tapped")     }     //work     buttonB?.valueChangedHandler = {(_ button: GCControllerButtonInput, _ value: Float, _ pressed: Bool) -> Void in       print(">>> ButtonB tapped")     }           // this is not works     gameController.motion?.valueChangedHandler = { (motion: GCMotion)->() in       print(">>>> motion data \(motion.acceleration.x) \(motion.acceleration.y) \(motion.acceleration.z)")       if let delegate = self.motionDelegate {         delegate.motionUpdate(motion: motion)       }     } Is there any plan to support this?
4
3
2.5k
Aug ’22
WebGL canvas stop rendering.
https://vimeo.com/957974306 Canvas #1(Unity) stopped rendering context when I switch tab on inspector. Also my device 13 pro max running iOS 17.5.1 lost context when I screenshot. It has no log in console. Not happened on 13 pro max running iOS 16.4
1
0
269
Jul ’24
Inquiry about Background Assets and User Experience in App Store
Dear Apple Developer Support, I have a question regarding the Background Assets feature for a game we are planning to release on the App Store. Specifically, I would like to understand the user experience during the initial installation process. If our game utilizes the Background Assets feature and we have essential assets specified in the BAExtension, will the end user need to wait for these essential assets to be fully downloaded before they can open the game after installing it from the App Store? Additionally, during this download process, will there be any indication of the essential assets' download status on the App Store or on the home screen icon of the game? Your guidance on how this process is managed and what the user can expect would be greatly appreciated. Thank you for your assistance.
2
0
390
Jul ’24