Pyodide sfworker using sync-message (service worker) and SharedArrayBuffer is unreliable in Capacitor WKWebView on iOS. Service workers in WKWebView require iOS 16.4+ and scope must match WebView URL scheme. SharedArrayBuffer requires COOP+COEP headers which a Capacitor static build has no HTTP server to set.
Three mitigations: (1) Use Comlink postMessage instead of sync-message on native platform, (2) Set COOP/COEP via Capacitor server.headers config in capacitor.config.ts, (3) Fall back to a server-side /evaluate endpoint if WASM load fails. The Capacitor server.headers approach works for SharedArrayBuffer but service worker scope issues remain on iOS.