Skip to content

Fix Wi-Fi password commands failing with "Could not get connected network info - #344

Merged
ospfranco merged 2 commits into
ospfranco:mainfrom
memit0:main
Nov 1, 2026
Merged

ospfranco merged 2 commits into
ospfranco:mainfrom
memit0:main

Conversation

@memit0

@memit0 memit0 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Problem

"Copy Wi-Fi Password to Clipboard" and "Reveal Wi-Fi Password" fail with:

Could not retrieve password: Error: Exception in HostFunction: Could not get connected network info

On recent macOS, CWInterface.ssid returns nil unless the app has location authorization. In getWifiPassword:

  • The CLLocationManager was a local, deallocated right after requestAlwaysAuthorization, which dismisses the prompt, so authorization often stays undetermined.
  • The SSID was read immediately after requesting, before the user could answer.

Fix

  • Keep a single CLLocationManager alive for the app's lifetime and request authorization on the main queue.
  • When authorization is undetermined, request it and ask the user to try again instead of failing.
  • Specific errors for Location Services off, denied/restricted access, Wi-Fi off, and not connected.
  • getWifiInfo reuses the same manager.
  • "Reveal Wi-Fi Password" showed its "no password" case as a success toast; it's now an error.

Testing

Not built or run yet; needs a check in Xcode on macOS.

The CLLocationManager was a local that got deallocated right after
requesting authorization, which dismisses the prompt, and the SSID was
read immediately without waiting for the user's answer. Keep a single
manager alive, ask for access when undetermined, and show specific
errors for denied access, Wi-Fi off, and no network.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GhMBdqdm6aKrKNwWyhJjJH
@ospfranco
ospfranco merged commit e9c946e into ospfranco:main Nov 1, 2026
@ospfranco

Copy link
Copy Markdown
Owner

thx for the fix. I unfortunately I'm not on my main computer for the next weeks, so I cannot do a release, but will do one once I'm back home

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants