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

GameKit Documentation

Posts under GameKit tag

84 Posts
Sort by:
Post not yet marked as solved
0 Replies
341 Views
The documentation for how to handle focus & triggering the GKAccessPoint seems to be outdated for tvOS: https://developer.apple.com/documentation/gamekit/adding_an_access_point_to_your_game For tvOS specifically, the documentation has examples that refer to GKAccessPoint.focusFeedback and GKAccessPoint.shared.triggerAccessPoint which don't exist. I can use shared.isFocused() instead of .focusFeedback(), and .trigger {} instead of .triggerAccessPoint {}, but then it seems I can either set the focus to the accessPoint or I can trigger it, but I can't do both. For example, the following code captures the focus via a button, and then redirects the focus to the GKAccessPoint. You can still press the tvOS remote to visually show the button pressing, but it never prints out anything or triggers the access point. If you remove the .focusable(true) {...} section at the end, then the button will trigger the accessPoint, but it won't show it as focused. I seem to be missing something! Any ideas? #if os(tvOS) // this is used to "capture" focus invisibly, so it can be handed off to Game Center's GKAccessPoint VStack(alignment: .leading, content: { Button("") { print("Button representing GKAccessPoint was pressed!") GKAccessPoint.shared.trigger { print("\nI WAS TRIGGERED!!! by a button\n") } } .focusable(true) { isFocused in if isFocused { print("focused!") GKAccessPoint.shared.isFocused = true } else { GKAccessPoint.shared.isFocused = false print("NOT focused!") } } .opacity(0.1) }) .focusSection() #endif
Posted
by gorm.
Last updated
.
Post not yet marked as solved
0 Replies
342 Views
I am trying to test game center multiplayer with the IOS simulator and my physical phone. I can get it working between 2 physical phones but whenever I try with the simulator it shows the error Failed to find players. I have seen people use the simulator before to test multiplayer. I have tried both my account and a sandbox account with no luck. Is there something I am missing or doing wrong? I am using gamekit to make this app. Thanks
Posted Last updated
.
Post not yet marked as solved
5 Replies
636 Views
I attempted to use the new App Store Connect API 3.0 feature to manage Game Center achievements. My goal was to create a bunch of achievements, with one en-US localization each, with an attached image. Creating the achievement and its localization initially seems to have worked fine; I uploaded the image, and its assetDeliveryState.state is COMPLETED. But when I visit the achievement in the App Store Connect Console UI, all the images I've uploaded are 404 Not Found. I'm going to have to upload all of these images by hand. 😭 Here's the sample code I used, using the https://github.com/dfabulich/node-app-store-connect-api v5.0.3. import { api } from 'node-app-store-connect-api'; import { readFile, stat } from 'node:fs/promises'; import { homedir } from 'node:os'; const appId = 6468677114; const vendorIdentifier = 'com.example.myachievement'; const showBeforeEarend = true; const points = 10; const locale = "en-US"; const title = "My Achievement"; const afterEarnedDescription = "Earned the achievment."; const beforeEarnedDescription = "Earn the achievement."; const fileName = `${vendorIdentifier}.png`; const params = { issuerId: "69a6de6f-0d6d-47e3-e053-5b8c7c11a4d1", apiKey: "3S3G8T48YW", }; params.privateKey = await readFile(`${homedir()}/.appstoreconnect/private_keys/AuthKey_${params.apiKey}.p8`, 'utf8'); const { read, create, uploadAsset, pollForUploadSuccess } = await api(params); const {data: gameCenterDetail} = await read(`apps/${appId}/gameCenterDetail`); console.log('creating', vendorIdentifier); const gameCenterAchievement = await create({ type: 'gameCenterAchievements', attributes: { referenceName: title, vendorIdentifier, points, repeatable: false, showBeforeEarned, }, relationships: { gameCenterDetail } }); console.log(' localization'); const gameCenterAchievementLocalization = await create({ type: 'gameCenterAchievementLocalizations', attributes: { locale, name: title, afterEarnedDescription, beforeEarnedDescription, }, relationships: { gameCenterAchievement } }); console.log(' image'); const image = await create({ type: 'gameCenterAchievementImages', attributes: { fileName, fileSize: (await stat(fileName)).size, }, relationships: { gameCenterAchievementLocalization } }); console.log(' upload'); await uploadAsset(image, await readFile(fileName)); console.log(' poll'); await pollForUploadSuccess(image.links.self);
Posted
by dfabulich.
Last updated
.
Post not yet marked as solved
1 Replies
418 Views
I am trying to create an iOS plugin for the Godot game engine which utilises GameKit. For some reason it is struggling to build the required static library when #import <GameKit/GameKit.h> is utilised. This does not seem to be a specific Godot issue looking through the error log and seems to be a direct issue with the SDK in XCode 15. Here is an extract from the compilation error for reference (I cannot submit the full error due to forum limitations): scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... g++ -o plugins/gamecenter/game_center_module.o -c -fomit-frame-pointer -O2 -ftree-vectorize -DNDEBUG -DNS_BLOCK_ASSERTIONS=1 -DDEBUG_ENABLED -DPTRCALL_ENABLED -DGLES_ENABLED -std=gnu++14 -DNEED_LONG_INT -DLIBYUV_DISABLE_NEON -DIOS_ENABLED -DUNIX_ENABLED -DCOREAUDIO_ENABLED -fmodules -fcxx-modules -miphoneos-version-min=10.0 -fobjc-arc -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fblocks -fvisibility=hidden -MMD -MT dependencies -fno-exceptions -Wno-ambiguous-macro -Wall -Werror=return-type -arch arm64 -isysroot -stdlib=libc++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk -DPTRCALL_ENABLED -I. -Igodot -Igodot/platform/iphone plugins/gamecenter/game_center_module.cpp g++ -o plugins/gamecenter/game_center.o -c -fomit-frame-pointer -O2 -ftree-vectorize -DNDEBUG -DNS_BLOCK_ASSERTIONS=1 -DDEBUG_ENABLED -DPTRCALL_ENABLED -DGLES_ENABLED -std=gnu++14 -DNEED_LONG_INT -DLIBYUV_DISABLE_NEON -DIOS_ENABLED -DUNIX_ENABLED -DCOREAUDIO_ENABLED -fmodules -fcxx-modules -miphoneos-version-min=10.0 -fobjc-arc -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fblocks -fvisibility=hidden -MMD -MT dependencies -fno-exceptions -Wno-ambiguous-macro -Wall -Werror=return-type -arch arm64 -isysroot -stdlib=libc++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk -DPTRCALL_ENABLED -I. -Igodot -Igodot/platform/iphone plugins/gamecenter/game_center.mm g++ -o plugins/gamecenter/game_center_delegate.o -c -fomit-frame-pointer -O2 -ftree-vectorize -DNDEBUG -DNS_BLOCK_ASSERTIONS=1 -DDEBUG_ENABLED -DPTRCALL_ENABLED -DGLES_ENABLED -std=gnu++14 -DNEED_LONG_INT -DLIBYUV_DISABLE_NEON -DIOS_ENABLED -DUNIX_ENABLED -DCOREAUDIO_ENABLED -fmodules -fcxx-modules -miphoneos-version-min=10.0 -fobjc-arc -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fblocks -fvisibility=hidden -MMD -MT dependencies -fno-exceptions -Wno-ambiguous-macro -Wall -Werror=return-type -arch arm64 -isysroot -stdlib=libc++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk -DPTRCALL_ENABLED -I. -Igodot -Igodot/platform/iphone plugins/gamecenter/game_center_delegate.mm scons: `bin/libgamecenter.arm64-ios.release_debug.a' is up to date. scons: done building targets. scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... g++ -o plugins/gamecenter/game_center_module.o -c -O2 -ftree-vectorize -DNDEBUG -DNS_BLOCK_ASSERTIONS=1 -DDEBUG_ENABLED -DPTRCALL_ENABLED -DGLES_ENABLED -std=gnu++14 -fno-aligned-allocation -DNEED_LONG_INT -DLIBYUV_DISABLE_NEON -DIOS_ENABLED -DUNIX_ENABLED -DCOREAUDIO_ENABLED -fmodules -fcxx-modules -miphoneos-version-min=10.0 -fobjc-arc -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fblocks -fvisibility=hidden -MMD -MT dependencies -fno-exceptions -Wno-ambiguous-macro -Wall -Werror=return-type -arch armv7 -isysroot -stdlib=libc++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk -DPTRCALL_ENABLED -I. -Igodot -Igodot/platform/iphone plugins/gamecenter/game_center_module.cpp g++ -o plugins/gamecenter/game_center.o -c -O2 -ftree-vectorize -DNDEBUG -DNS_BLOCK_ASSERTIONS=1 -DDEBUG_ENABLED -DPTRCALL_ENABLED -DGLES_ENABLED -std=gnu++14 -fno-aligned-allocation -DNEED_LONG_INT -DLIBYUV_DISABLE_NEON -DIOS_ENABLED -DUNIX_ENABLED -DCOREAUDIO_ENABLED -fmodules -fcxx-modules -miphoneos-version-min=10.0 -fobjc-arc -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fblocks -fvisibility=hidden -MMD -MT dependencies -fno-exceptions -Wno-ambiguous-macro -Wall -Werror=return-type -arch armv7 -isysroot -stdlib=libc++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk -DPTRCALL_ENABLED -I. -Igodot -Igodot/platform/iphone plugins/gamecenter/game_center.mm While building module 'GameKit' imported from plugins/gamecenter/game_center_delegate.h:31: While building module 'simd' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk/System/Library/Frameworks/GameKit.framework/Headers/GameKit.h:3: In file included from <module-includes>:1: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk/usr/include/simd/simd.h:23: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk/usr/include/simd/matrix.h:1105:25: error: use of undeclared identifier 'vzip1q_f32'; did you mean 'vzipq_f32'? [2] simd_float4 __r01 = vzip1q_f32(__x0, __x1); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/include/arm_neon.h:32079:20: note: 'vzipq_f32' declared here [2] __ai float32x4x2_t vzipq_f32(float32x4_t __p0, float32x4_t __p1) { ...... ....... ....... 30 errors generated. scons: *** [plugins/gamecenter/game_center.o] Error 1 scons: building terminated because of errors.
Posted
by Gavin_A.
Last updated
.
Post not yet marked as solved
1 Replies
547 Views
As per the title, as soon as I try to open iCloud settings on the Simulator, a black screen appears and the Preferences app crashes (and a crash report shows up shortly thereafter). This is an issue in all of Xcode 17.0.0, XCode 17.0.1 and the Xcode 17.1 beta. I've tried all the simulator models from the SE to the 15. I think this may be something to do with the following two pop-ups that keep showing up on the Simulator but don't actually do anything when tapped: one says to accept new iCloud T&Cs. When I tap on it, nothing happens (and I can't find new T&Cs to accept in the web browser); and one that prompts me to re-enter the Apple ID password. When I input the password and confirm, nothing happens. This is causing major issues for testing a couple of my apps because Simulator sometimes radomly thinks that the user isn't signed into iCloud when they, in fact, are. For example, I've been getting the following error from GameKit: 'The requested operation could not be completed because you are not signed in to iCloud..' (the same function that throws the error does confim that the user is signed in just before throwing). I'd be very grateful for any thoughts. Been stuck on this for well over a week now...I've found various threads about the wider Preferences app crashing (and this being fixed in the latest beta) but nothing on the specific issue I'm having.
Posted
by agaS95.
Last updated
.
Post not yet marked as solved
0 Replies
483 Views
Hi guys, I want to build a referral program wherein current users are rewarded for inviting friends to join my app/website. I also wanted to keep the accounts linked so that recruiting users can get rewarded every time a new user they recruited purchases something. I want to just give the users points, I'm not offering cash or subscription discounts. similar to how game invites work. through my research into the topic I have found dynamic links with flutter and firebase. deep deferred links, QR code deferred links, and some work around that included taking the user to a website copying the code to their clipboard, then pasting it into a hidden textfield to verify and track the code can anyone help me get started?
Posted
by bush123.
Last updated
.
Post not yet marked as solved
5 Replies
3k Views
Prior to iOS 14.5, I adopted the following workflow for my Game Center enabled game - At the launch, if there is no authenticated GKLocalPlayer, then store the viewController passed in the completion handler and display it later to the user (i.e. not immediately after the app completes launching). I am using the following code for the authentication process -         GKLocalPlayer.local.authenticateHandler = {viewController, error in             if (viewController != nil){ //store the viewController and present it at a later time             } else if (GKLocalPlayer.local.isAuthenticated) { //successfully authenticated             } else { // player could not be authenticated             } Since iOS 14.5 the callback to the authenticationHandler seems to have changed. The login prompt is displayed automatically after app launch, if there is no authenticated player. I checked - the completionHandler is not even being called in this case before the login prompt is presented. If there is already an authenticated player on the device, then the handler is called as expected. How can I prevent the login prompt from being displayed automatically by the system? Is there a new workflow for authenticating a player from iOS 14.5 onwards? thanks,
Posted Last updated
.
Post not yet marked as solved
2 Replies
1.7k Views
HELLO WORLD! I am currently developing an amazing Unity mini Game. The game development has come to the deploying stage. Using Unity allows me to deploy this game on MacOS, iOS, Android and Windows which is fantastic . However, I really need this game to have the iOS widget extension as a key feature on mobile. Just like the "Steve" dinosaur game which can be played in widget. I had seen a lot of tutorials and youtube videos but still cant find a solution which make Unity iOS app into a widget. If I really want to make widget Game on iOS, do I need to develop the whole game all over again in xcode or using GameKit? Really hoping there's a way to simply convert the Unity iOS app into a widget.
Posted Last updated
.
Post not yet marked as solved
1 Replies
1.2k Views
We are using the Apple Unity plugin (Gamekit) to authorize players, using a Game Center account. To get player info we run a task from the plugin, var fetchItemsResponse = await GKLocalPlayer.Local.FetchItems(); But when this code run, there is an error in Xcode. The error is the following, Thread 1: EXC_BAD_ACCESS (code=257, address=0x2) MacOS 12.5 Monterey Unity 2021.3.4f1 XCode 14.2 AppleCore Unity Package - 1.0.2 AppleGameKit Unity Package - 1.0.3 Crashes when calling FetchItems in Unity Installed in iPhone XR (iOS 15.2.1)
Posted
by k3ndro1.
Last updated
.
Post not yet marked as solved
2 Replies
742 Views
I have implemented a standard GKLeaderboard in my app. The leaderboard includes the player's avatar, display name, and the score. I only use functionality provided by GameKit without any custom server functionality. I don't even have an own server. Still, my app got rejected with the following notice: We noticed that your app does not obtain the user's consent prior to uploading users' scores to a global leaderboard. To collect personal data with your app, you must make it clear to the user that their personal data will be uploaded to your server. What should I do here? Do I really have to obtain user's consent before uploading his score to Game Center?
Posted Last updated
.
Post not yet marked as solved
0 Replies
458 Views
We transferred application, using guide there: https://developer.apple.com/help/app-store-connect/transfer-an-app/overview-of-app-transfer/ We use Game Center to identify users via playerid https://developer.apple.com/documentation/gamekit/gkplayer/1521127-playerid After transferring application playerid for our current users is changed, and so users are unable to login How can we restore playerid for our users? For "Sign in with Apple" there are migration process, so there are no issues, is there something like that for Game Center?
Posted
by Temuri.
Last updated
.
Post not yet marked as solved
0 Replies
409 Views
This may be a dumb question, but I can’t seem to find an answer that I understand. If I integrate GameKit/GameCenter into my game, essentially just to auth and then unlock achievements, MAYBE a leaderboard; do I become liable for player data under for ex. GDPR? I don’t plan on sending it anywhere so I guess that’s why I’m so unsure.
Posted
by bengsfort.
Last updated
.
Post not yet marked as solved
0 Replies
366 Views
In the app, when logged into Game Center and moving the app to the background and then returning to the foreground, the Game Center login message is displayed at the top every time. Before iOS 17, this message was only shown at the initial login and app launch. However, from iOS 17, this message is displayed during the transition from background to foreground. Is this an intended feature or a bug?
Posted
by herohjk.
Last updated
.
Post not yet marked as solved
1 Replies
499 Views
I got the sample project from Apple’s official documentation (https://developer.apple.com/documentation/gamekit/creating_real-time_games/). That sample project is a simple real-time game where two players are immediately aware of the actions each other takes. I figured out that one of the player's phone keeps buzzing when the voice chat is turned on. Suppose we have player A and player B. When the Voice Chat is activated, I noticed that player A can clearly hear player B's voice, but player B cannot hear anything except for their own voice, which can be heard by player A. Occasionally, this situation can switch. When a player is unable to hear anything, they only hear a constant beeping sound, even though their voice can still be heard by others. What happen? Anyone figured out how to solve this?
Posted Last updated
.
Post not yet marked as solved
2 Replies
1.3k Views
The documentation suggests that it should be possible to use a single shader with multiple instances of an SKNode, such that each instance will use the unique SKAttributes that are passed to it. Let's try that with an SKShapeNode. This is the fragment shader testFill.fsh, simply coloring based on the value for a_test: void main() {     gl_FragColor = vec4(vec3(a_test), 1.0); } And here we make two nodes `testNode0`, and `testNode1`, each using the same shader, but with a different value for `a_test`: class GameScene: SKScene {     override func didMove(to view: SKView) {         let testShader = shaderWithFilename( "testFill", fileExtension: "fsh", uniforms: [])         testShader.attributes = [             SKAttribute(name: "a_test", type: .float)         ] let testNode0 = SKShapeNode(rect: CGRect(x: 0.0, y: 0.0, width: 100.0, height: 100.0)) testNode0.fillShader = testShader testNode0.position = CGPoint(x: -100, y: 300) testNode0.setValue(SKAttributeValue(float: 0.2), forAttribute: "a_test") addChild(testNode0) let testNode1 = SKShapeNode(rect: CGRect(x: 0.0, y: 0.0, width: 100.0, height: 100.0)) testNode1.fillShader = testShader testNode1.position = CGPoint(x: 100, y: 300) testNode1.setValue(SKAttributeValue(float: 0.8), forAttribute: "a_test") addChild(testNode1) } } Here is the result: The squares are the same color, in particular the result of passing the second value 0.8 for a_test. Now, let's try the same thing with SKSpriteNode: class GameScene: SKScene {     override func didMove(to view: SKView) {         let testShader = shaderWithFilename( "testFill", fileExtension: "fsh", uniforms: [])         testShader.attributes = [             SKAttribute(name: "a_test", type: .float)         ] let testNode0 = SKSpriteNode() testNode0.size = CGSize(width: 100.0, height: 100.0) testNode0.shader = testShader testNode0.position = CGPoint(x: -100, y: 300) testNode0.setValue(SKAttributeValue(float: 0.2), forAttribute: "a_test") addChild(testNode0) let testNode1 = SKSpriteNode() testNode1.size = CGSize(width: 100.0, height: 100.0) testNode1.shader = testShader testNode1.position = CGPoint(x: 100, y: 300) testNode1.setValue(SKAttributeValue(float: 0.8), forAttribute: "a_test") addChild(testNode1) } } And it works! Why does the documentation not say that this is not possible with an SKSpriteNode? Why does an SKSpriteNode have a .setValue method if it does not function as expected? Is this a bug? Or something that is expected to be obvious? I am not sure, but I am sharing this in case somebody else ends up stuck on this issue as I was when otherwise trying to do something relatively straightforward. The solution (if your shape is a simple rect, as it is in my case) is to initialize an empty SKSpriteNode and size it accordingly, after which SKAttributes should work as expected. Apple, please either fix this, or update the documentation.
Posted
by chaimp.
Last updated
.
Post not yet marked as solved
7 Replies
1.5k Views
An issue appeared on IOS 16.4 when presenting GKMatchmakerViewController with the matchmakingMode set to inviteOnly. The view controller appears with the invite option as expected. But trying to tap it, the GKMatchmakerViewController disappears immediately. No problem on the previous IOS versions. It works also when matchmakingMode is not used at all.
Posted
by adalat.
Last updated
.
Post not yet marked as solved
0 Replies
377 Views
Hello, We have an API that wraps around Game Center API and we would like to have automated tests for our API. The test would need to run in a remote data center, so there is no way to perform manual test steps. Ideally, we would want to simulate sign in and sign out, test achievements and game saves without the need for any manual input. Running in the simulator should be enough for our use case, though we could also use real devices if necessary. Is there any way to accomplish that?
Posted Last updated
.
Post not yet marked as solved
0 Replies
374 Views
What should an app do with an instance of GKGameCenterViewController when the app transitions to the background? Currently, my app just leaves it in place, displayed on top in full screen. Most of the time when my app resumes to the foreground, the GKGameCenterViewController is still displayed and is functional. However, sometimes when the app resumes, the GKGameCenterViewController's view has vanished and, additionally, my app doesn't receive a GK authentication event, so effectively it is "hung". This seems to happen most often when the app has been in the background a while, such as overnight. The app is still in memory, however, not starting cold. I would like to leave the GKGameCenterViewController/view in place when the app is backgrounded since the player may return to the game quickly and be right back where they left off. And most of the time that works. However, I need to solve the problem for the times it doesn't as I described above. Is there any guidance on what to do with a GKGameCenterViewController (or any GK controller for that matter) when an app goes into the background?
Posted
by ajpro.
Last updated
.