Game Center switch before submit: apple submit / resubmit and signing ensure create gameCenterDetails and gameCenterAppVersions when Game Center is in use (config, entitlements or the built IPA), shown in the dry run; validate blocks on either missing; fake 409 BUILD_INDICATES_GAME_CENTER_ENABLED until both exist; pitfall 89

This commit is contained in:
CRTkafa 2026-10-21 05:33:53 +07:00
parent dd9e059036
commit 163e666834
9 changed files with 152 additions and 26 deletions

View file

@ -2,18 +2,18 @@
// Local part (no network): the Game Center entitlement, the PGS APP_ID resource and Gradle dependency, the player-id
// declaration reminders. Store part: Game Center (App ID capability, detail, version switch, counts, pending changes)
// and Play Games Services (counts, pending changes).
import { readGameCenter } from './apple/game-center';
import { gameCenterInUse, readGameCenter } from './apple/game-center';
import { ascClient } from './apple/asc';
import { readProjectEntitlements } from './apple/signing';
import type { Loaded } from './lib/config';
import { consoleUrl } from './lib/console-links';
import { type Finding, gamesPrivacyFindings, gcFindings, hasAndroidProject, planGameCenter, planPlayGames, pgsFindings, readPgsProject, usesGameCenter, usesPlayGames } from './lib/game-services';
import { type Finding, gamesPrivacyFindings, gcFindings, hasAndroidProject, planGameCenter, planPlayGames, pgsFindings, readPgsProject, usesPlayGames } from './lib/game-services';
import type { Finding as VFinding } from './lib/validate-rules';
import { gamesConfigClient, playDefaultLocale, readPlayGames } from './play/games';
export interface GameServicesStatus {
apple: null | { capability: boolean | null; enabled: boolean; version: string | null; versionEnabled: boolean | null; leaderboards: number; achievements: number;
config: { leaderboards: number; achievements: number }; changes: string[]; error?: string };
config: { leaderboards: number; achievements: number }; changes: string[]; error?: string; why?: string };
play: null | { appId: string | null; resource: string | null; leaderboards: number; achievements: number;
config: { leaderboards: number; achievements: number }; changes: string[]; error?: string };
findings: (Finding & { store: 'apple' | 'play' })[];
@ -40,13 +40,14 @@ export async function gameServicesStatus(loaded: Loaded, o: { apple?: boolean; p
const out: GameServicesStatus = { apple: null, play: null, findings, links: [] };
const count = (store: 'apple' | 'play') => ({ leaderboards: (g.leaderboards ?? []).filter(x => !x.platforms || x.platforms.includes(store === 'apple' ? 'ios' : 'android')).length,
achievements: (g.achievements ?? []).filter(x => !x.platforms || x.platforms.includes(store === 'apple' ? 'ios' : 'android')).length });
if (config.apple && usesGameCenter(config) && o.apple !== false) {
const gcUse = config.apple ? gameCenterInUse(config, root) : { inUse: false, why: null };
if (config.apple && gcUse.inUse && o.apple !== false) {
out.links.push({ label: 'App Store Connect: the version page (Game Center section)', url: consoleUrl('asc.version') });
try {
const c = await ascClient(root, config.apple.bundleId, config.apple.appId);
const s = await readGameCenter(c, config.apple.bundleId);
out.apple = { capability: s.capability, enabled: !!s.detail, version: s.version?.versionString ?? null, versionEnabled: s.version ? s.version.enabled : null,
leaderboards: s.leaderboards.length, achievements: s.achievements.length, config: count('apple'), changes: changesOf(planGameCenter(g, config.languages, s)) };
leaderboards: s.leaderboards.length, achievements: s.achievements.length, config: count('apple'), changes: changesOf(planGameCenter(g, config.languages, s)), why: gcUse.why ?? undefined };
} catch (e) { out.apple = { capability: null, enabled: false, version: null, versionEnabled: null, leaderboards: 0, achievements: 0, config: count('apple'), changes: [], error: (e as Error).message.slice(0, 300) }; }
}
if (config.play && usesPlayGames(config) && o.play !== false) {
@ -71,8 +72,10 @@ export function gameServicesFindings(s: GameServicesStatus): VFinding[] {
if (a.error) out.push({ store: 'apple', level: 'warn', code: 'game-center', msg: `Game Center not read: ${a.error}` });
else {
if (a.capability === false) out.push({ store: 'apple', level: 'blocker', code: 'game-center.capability', msg: 'games.gameCenter is true but the App ID has no GAME_CENTER capability: the build\'s profile will not allow Game Center', fix: 'storebound apple signing ensure --dry, then without --dry' });
if (!a.enabled) out.push({ store: 'apple', level: 'blocker', code: 'game-center.detail', msg: 'Game Center is not switched on for the app in App Store Connect', fix: 'storebound apple game-center --dry, then without --dry' });
if (a.versionEnabled === false) out.push({ store: 'apple', level: 'warn', code: 'game-center.version', msg: `version ${a.version} does not have Game Center switched on`, fix: 'storebound apple game-center' });
const why = a.why ? ` (${a.why})` : '';
const bounce = 'the submission would answer 409 STATE_ERROR.BUILD_INDICATES_GAME_CENTER_ENABLED';
if (!a.enabled) out.push({ store: 'apple', level: 'blocker', code: 'game-center.detail', msg: `Game Center is in use${why} but the app has no Game Center detail in App Store Connect: ${bounce}`, fix: 'storebound apple game-center --dry, then without --dry (apple submit runs the same switch)' });
if (a.versionEnabled === false) out.push({ store: 'apple', level: 'blocker', code: 'game-center.version', msg: `Game Center is in use${why} but version ${a.version} has no Game Center switch (gameCenterAppVersion): ${bounce}`, fix: 'storebound apple game-center --dry, then without --dry (apple submit runs the same switch)' });
if (a.changes.length) out.push({ store: 'apple', level: 'warn', code: 'game-center.sync', msg: `Game Center differs from the config: ${a.changes.slice(0, 6).join('; ')}${a.changes.length > 6 ? ` (+${a.changes.length - 6})` : ''}`, fix: 'storebound apple game-center --dry' });
if (a.enabled && !a.changes.length) out.push({ store: 'apple', level: 'ok', code: 'game-center', msg: `Game Center on: ${a.leaderboards} leaderboard(s), ${a.achievements} achievement(s), in step with the config` });
}