Menu

Three bugs I shipped in a Capacitor iOS app, and how small the fixes were
📰

Three bugs I shipped in a Capacitor iOS app, and how small the fixes were

DEV Community: capacitor·João from UMDIA·1 day ago
#7RP27BAc
#devtocapacitor#devto#dev#capacitor#plugin
Long article (744 words) — no AI summary yet.
Reading 0:00
15s threshold

I build UMDIA, an iPhone app for learning European Portuguese. It's React and Vite wrapped in Capacitor, with Firebase behind it. The web-to-native setup has been good to me, but it has a few traps that don't show up in the browser. These three made it into App Store builds before I caught them.

1. A Capacitor plugin returned from a promise calls .then on the native side

App Check never worked in version 1.0. No crash and no visible error: the token request just never happened. The cause was this pattern:

async function loadAppCheck ( ) { const { FirebaseAppCheck } = await import ( '@capacitor-firebase/app-check' ) await FirebaseAppCheck . initialize ( options ) return FirebaseAppCheck // the bug }

Enter fullscreen mode

Exit fullscreen mode

A Capacitor plugin is a Proxy . Any property you read on it becomes a call to a native method. When an async function returns a value, JavaScript checks whether that value is a thenable by reading .then .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.