Mac Catalyst game crashes on GKAchievementInternal showBanner

Every time I submit an achievement to Game Center on macOS, using Mac Catalyst, my game crashes with this:

Code Block
-[GKAchievementInternal showBanner]: unrecognized selector sent to instance 0x600002616ca0


No call stack. I set a break point for all the Obj-C exceptions but it's just stopped in the AppDelegate.

Everything is fine on iOS and iPadOS, and the rest of the Game Center behaviour on macOS seems to be fine.

For reference, this is how I submit the achievements:

Code Block swift
    private func submitAchievements(_ aList: [Achievement]) {
        if !isGameCenterEnabled {
            return
        }
        var achievements : [GKAchievement] = []
        for kvp in AchievementFromId {
            if aList.contains(kvp.1) {
                let achievement = GKAchievement(identifier: kvp.0)
                achievement.showsCompletionBanner = true
                achievement.percentComplete = 100.0
                achievements.append(achievement)
            }
        }
        if achievements.count > 0 {
            GKAchievement.report(achievements, withCompletionHandler: { (error: Error?) -> Void in
                if let err = error {
                    NSLog("submitAchievements: \(err.localizedDescription)")
                }
            })
        }
    }


That function uses these data structures:

Code Block swift
enum Achievement : Int {
    case
    clearTutorial =   0x00000001,
    clearLevel1   =   0x00000002,
    clearLevel2   =   0x00000004,
}
let AchievementFromId : [String : Achievement] = [
    "Tutorial": .clearTutorial,
    "Level1": .clearLevel1,
    "Level2": .clearLevel2,
]


Also, how can I reset the achievements for one user? Because in order to debug this I already run out of chances... I need to keep creating new users in order to test the completion banner, since it's shown only once.

Replies

Please file a feedback with the crash report attached.
Thank you. I submitted a feedback with the Feedback Assistant. In the meantime, the only workaround I found is disabling the completion banner in Mac Catalyst:

Code Block swift
                #if targetEnvironment(macCatalyst)
                achievement.showsCompletionBanner = false
                #else
                achievement.showsCompletionBanner = true
                #endif


And to test the achievements, I used the resetAchievements:

Code Block swift
        GKAchievement.resetAchievements() { error in
            if let error = error {
                NSLog("resetAchievements: \(error.localizedDescription)")
            } else if let fn = onCompletion {
                syncAchievements() // function that resubmits all the achievements again
            }
        }