When you’re deep in development, you expect bugs, but sometimes they’re not where you expect. I spent significant time chasing a bug caused, not by me, but by the iOS simulator itself.
Let’s look at what happened.

When you’re deep in development, you expect bugs, but sometimes they’re not where you expect. I spent significant time chasing a bug caused, not by me, but by the iOS simulator itself.
Let’s look at what happened.
I was working on a feature that used OpenAI’s realtime voice API. To do this securely, the client-side React Native app needed to get a temporary session token from a Supabase Edge Function.
The process should be simple:
When I tested the edge function directly using Postman, it worked perfectly every time. But when the app tried to make the exact same call from the iOS simulator, it failed with a cryptic error:
[FunctionsFetchError: Failed to send a request to the Edge Function]
This immediately pointed to a Cross-Origin Resource Sharing (CORS) issue, a common problem when a client app tries to communicate with a backend on a different domain. And so, the debugging began.
The logical first step was to attack the presumed CORS issue. I meticulously configured the CORS headers in my Supabase Edge Function, ensuring it would accept requests from any origin.
// client/supabase/functions/_shared/cors.ts
export const corsHeaders = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "authorization, x-client-info, apikey, content-type",
"Access-Control-Allow-Methods": "POST, OPTIONS",
}
After deploying the changes, the error remained. Over the next few days, I tried everything I could think of to isolate the problem, with the error message sometimes changing to an even more generic [TypeError: Network request failed].
fetch instead of supabase.functions.invoke, thinking it might give me a more detailed error. It didn’t.fetch call to a known-good public API (like GitHub). This worked perfectly, proving the app could make network requests, just not to my Supabase function.This last step was the key turning point. The logs showed my requests from Postman arriving and succeeding every time. But requests from the iOS simulator never appeared in the logs at all.
It meant the requests were being blocked before they even hit my function’s code. The code was right, the server config seemed right, but the connection simply wouldn’t go through.
When All Else Fails, Blame Your Tools.
After a while, the only variable left seemed to be the environment itself. I saw a hint online to try running the app on a different simulator. I had been using the latest iOS 18.4 simulator. I switched to an older iOS 17.5 simulator, re-ran the app, and it worked. Instantly.
The “impossible” bug was a glitch in the iOS 18.4 simulator.
If you find yourself in a similar situation, changing the simulator is straightforward.
+ icon in the bottom-left and select “iOS…”.--simulator flag in the React Native CLI, like so:npx react-native run-ios --simulator="iPhone 15 (17.5)"