From a01348e54c197b41e2f009dd66026b93d17630e7 Mon Sep 17 00:00:00 2001 From: Lalit Sharma Date: Tue, 24 Feb 2026 00:30:12 +0000 Subject: [PATCH] Fix iOS screenshot workflow notification permission popup --- .github/workflows/ios-simulator-screenshots.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/ios-simulator-screenshots.yml b/.github/workflows/ios-simulator-screenshots.yml index 41f35fd..c1d0f5b 100644 --- a/.github/workflows/ios-simulator-screenshots.yml +++ b/.github/workflows/ios-simulator-screenshots.yml @@ -336,8 +336,24 @@ jobs: xcrun simctl uninstall "$udid" "$BUNDLE_ID" || true xcrun simctl install "$udid" "$APP_PATH" + + ensure_notification_permission() { + local permission_state + permission_state="$(xcrun simctl privacy "$udid" get notifications "$BUNDLE_ID" 2>/dev/null || true)" + if [[ "$permission_state" == *"granted"* ]]; then + return 0 + fi + + xcrun simctl privacy "$udid" grant notifications "$BUNDLE_ID" || true + } + + # Avoid notification permission popups appearing in captured screenshots. + ensure_notification_permission xcrun simctl launch "$udid" "$BUNDLE_ID" + # Some iOS runtimes only persist the permission after first launch. + ensure_notification_permission + sleep "$STARTUP_WAIT_SECONDS" xcrun simctl io "$udid" screenshot "$shots_dir/00-launch.png" printf "00,launch,00-launch.png\n" >> "$shots_dir/manifest.csv"