S
Supabase2h ago
Ken

Swift SDK Crashes For New App

Hi all, I'm trying out Supabase for a MacOS app. Using version 2.5.1 (https://github.com/supabase/supabase-swift) and attempting to connect top my db, the app crashes immediately here: Here is my init :
let supabaseURL = "aws-0-us-east-1.pooler.supabase.com"
let supabaseKey = "sb_publishable_KEY"

client = SupabaseClient(
supabaseURL: URL(string: supabaseURL)!,
supabaseKey: supabaseKey,
options: .init(storage: .init())
)
let supabaseURL = "aws-0-us-east-1.pooler.supabase.com"
let supabaseKey = "sb_publishable_KEY"

client = SupabaseClient(
supabaseURL: URL(string: supabaseURL)!,
supabaseKey: supabaseKey,
options: .init(storage: .init())
)
let defaultStorageKey = "sb-\(supabaseURL.host!.split(separator: ".")[0])-auth-token"
let defaultStorageKey = "sb-\(supabaseURL.host!.split(separator: ".")[0])-auth-token"
Task 58: Fatal error: Unexpectedly found nil while unwrapping an Optional value
Task 58: Fatal error: Unexpectedly found nil while unwrapping an Optional value
GitHub
GitHub - supabase/supabase-swift: A Swift SDK for Supabase. Query y...
A Swift SDK for Supabase. Query your Supabase database, subscribe to realtime events, upload and download files, browse Swift examples, invoke postgres functions via rpc, invoke supabase edge funct...
5 Replies
garyaustin
garyaustin2h ago
That is not your API URL. Check API Settings.
What you show is the database pooler port.
Ken
KenOP2h ago
I attempted that URL host https://MYUUID.supabase.co but I ran into an error A server with the specified hostname could not be found. after googling and reading a few posts which led me to use the pooler port as noted above.
garyaustin
garyaustin2h ago
This is the correct URL.
No description
Ken
KenOP2h ago
Ah I figured it out, solution: In Xcode, I had to enable outgoing connections first via the Capabiltiies tab. Thanks again @garyaustin

Did you find this page helpful?