Skip to content

Compile Error Running 'python3 build.py' for Apple.GameKit #87

@jamesmcadamPSH

Description

@jamesmcadamPSH

When compiling the tgz as part of the Quick Start Guide for iOS and MacOS an error was being thrown for the Apple.GameKit.

Environment
Python Version: 3.14.3
Native library build using: Xcode 26.4 (17E192)
Unity Version: 2022.3.62f2

Error

../plug-ins/Apple.GameKit/Native/GameKitWrapper/GKGameActivityDelegate.swift:25:17: error: protocol 'GKGameActivityListener' requires 'player(_:wantsToPlay:completionHandler:)' to be available in iOS 13.0 and newer public func player(_ player: GKPlayer, wantsToPlay activity: GKGameActivity, completionHandler completion: @escaping WantsToPlayActivityCompletionHandler) {

GameKit.GKGameActivityListener.player:2:15: note: protocol requirement here optional func player(_ player: GKPlayer, wantsToPlay activity: GKGameActivity, completionHandler: @escaping @Sendable (Bool) -> Void)}

Potential Fix / Comments

I have no experience with swift but looking at the compile issue I made the following change and it was able to compile which has unblocked for the initial testing of my current task.

Image

My understanding here is that GKGameActivityListener is a protocol which is similar in concept to an interface which requires certain functionality to be implemented. The @available is similar to like a define in unity for specific versions for example UNITY_2021_3_OR_NEWER.

So when compiling these scripts targeting iOS 13.0 the function was essentially being stripped. However the interface requires the function. Moving the @available attribute to cover the whole GKWLocalPlayerListener means the interface is not expected anymore and hence it allows to be compiled for the iOS version.

While this allows compilation I have not sure if this is the correct fix or if there are other implications to this. Running on a test device I was at least able to log into game kit so I can continue with my setup / testing for now.

Any assistance would be greatly appreciated. Many thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions