File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -336,8 +336,24 @@ jobs:
336336
337337 xcrun simctl uninstall "$udid" "$BUNDLE_ID" || true
338338 xcrun simctl install "$udid" "$APP_PATH"
339+
340+ ensure_notification_permission() {
341+ local permission_state
342+ permission_state="$(xcrun simctl privacy "$udid" get notifications "$BUNDLE_ID" 2>/dev/null || true)"
343+ if [[ "$permission_state" == *"granted"* ]]; then
344+ return 0
345+ fi
346+
347+ xcrun simctl privacy "$udid" grant notifications "$BUNDLE_ID" || true
348+ }
349+
350+ # Avoid notification permission popups appearing in captured screenshots.
351+ ensure_notification_permission
339352 xcrun simctl launch "$udid" "$BUNDLE_ID"
340353
354+ # Some iOS runtimes only persist the permission after first launch.
355+ ensure_notification_permission
356+
341357 sleep "$STARTUP_WAIT_SECONDS"
342358 xcrun simctl io "$udid" screenshot "$shots_dir/00-launch.png"
343359 printf "00,launch,00-launch.png\n" >> "$shots_dir/manifest.csv"
You can’t perform that action at this time.
0 commit comments