Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth disabled notification after allowing bluetooth access M1 macOS 12.4 #68

Open
lesleyblankendal opened this issue Jun 29, 2022 · 18 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@lesleyblankendal
Copy link

Describe the bug
Bluetooth disabled notification after allowing bluetooth acces macOS 12.4. When the app launches I give it permission but all devices show as offline with a notification that my bluetooth is disabled. Also granted additional access in privacy & settings > bluetooth, to see if that makes any difference.

iPad version that can be run from Mac App Store on M1 iMac doesn't have this issue

Expected behavior
Sensors show as online

To Reproduce
Steps to reproduce the behavior:

  1. Open app on macOS
  2. grant bluetooth access
  3. Go to Home Screen
  4. See error

Screenshots
Schermafbeelding 2022-06-29 om 16 18 29

Your environment
Please describe the environment you are using:

  1. macOS 12.4, iMac 24 inch late 2020
  2. downloaded 4.1 update just now to see if it was fixed. Bug was introduced in 4.0
  3. 4.1
@lesleyblankendal lesleyblankendal added the bug Something isn't working label Jun 29, 2022
@lesleyblankendal lesleyblankendal changed the title Bluetooth disabled notification after allowing bluetooth acces M1 macOS 12.4 Bluetooth disabled notification after allowing bluetooth access M1 macOS 12.4 Jun 29, 2022
@emericg
Copy link
Owner

emericg commented Jun 30, 2022

Yes the Bluetooth and permission detection can be a little shaky on macOS, but that's usually not that problematic. I'll see if I can fix that once and for... well until next time it break anyway...

@emericg emericg self-assigned this Jul 22, 2022
@steveatinfincia
Copy link

I'm seeing this one too, though it works if the binary is launched from a terminal rather than through finder which is certainly strange.

@jeeftor
Copy link

jeeftor commented Dec 14, 2022

I also see it on an M1

@jeeftor
Copy link

jeeftor commented Dec 14, 2022

This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSBluetoothAlwaysUsageDescription key with a string value explaining to the user how the app uses this data.

I got this error when I ran it from CLI

@jeeftor
Copy link

jeeftor commented Dec 14, 2022

Sounds like a .plist issue...

@jeeftor
Copy link

jeeftor commented Dec 14, 2022

image

But it looks like you have the plist stuff...

@emericg
Copy link
Owner

emericg commented Dec 14, 2022

Indeed. Can you try with a more recent build?
https://github.com/emericg/WatchFlower/actions/runs/3660319742

It has both improvements and newer Qt version, maybe that will help.

@fabiang
Copy link

fabiang commented Apr 16, 2023

Still having this issue with version 5 on Mac OS 13.2.1. Also tried a recent build with no luck.

@emericg
Copy link
Owner

emericg commented Apr 20, 2023

Yes I'm really sorry, this problem has proven difficult to understand and to solve...
But I haven't forgotten it. It's just that I failed every time I had a look at it (last time being tonight :)

@fabiang
Copy link

fabiang commented Apr 20, 2023

I've also spent an hour trying to find the error. Imho this must be an upstream bug in Qt and/or OS X?

// Edit: Imho either the .entitlements is not applied correctly when the app is build for OS X and/or bluetooth access is only possible when the app correctly signed (and its a bug for untrusted apps).

@emericg
Copy link
Owner

emericg commented Apr 21, 2023

Imho this must be an upstream bug in Qt and/or OS X?

Yes Qt doesn't have a great integration of the "new" Bluetooth permission for macOS. That permission appeared recently, and it was working better before, that is a fact.
I had high hopes for the new permission system of Qt 6.5, but so far not much luck with it.

the .entitlements is not applied correctly when the app is build for OS X

There were even weirder cases before, like the app run through Qt Creator, run with a terminal or launched through the icon not behaving the same.
But now on my mac it is working, I don't have the permission issue anymore. It is working poorly though, it needs time to bring up the permission popup and after granting the permission it takes time to start working.

bluetooth access is only possible when the app correctly signed (and its a bug for untrusted apps).

That is definitely an issue. I think the app cannot save the permission if not signed, and so every time you launch the app it will ask for it again, and exhibit this issue. It cannot just launch with a permission granted and run like it was running before the permission issue.

@fabiang
Copy link

fabiang commented Dec 3, 2023

I think I figured it out. On my local install, I've just added this to my Info.plist:

<key>UIBackgroundModes</key>
<array>
   <string>bluetooth-central</string>
</array>

bluetooth-peripheral seems to work too as a value for this setting. According to this bluetooth-centralis the correct value: https://docs.silabs.com/bluetooth/3.1/general/connections/central-and-peripheral-roles#:~:text=In%20the%20BLE%20world%2C%20the,incoming%20connection%20request%20after%20advertising

Someone able to confirm this? Have it from here: https://stackoverflow.com/a/48390949 Possible value are here: https://developer.apple.com/documentation/bundleresources/information_property_list/uibackgroundmodes

@emericg
Copy link
Owner

emericg commented Dec 4, 2023

That's interesting, but it is said that UIBackgroundModes is only for iOS, and that using it prevents you from being accepted on the app store. Weird option...

I'll test this on a mac but yes we'll need people to confirm this has an actual impact beyond placebo.

@fabiang
Copy link

fabiang commented Dec 7, 2023

@emericg I've just checked if this automatically prevents you from being accepted to the Appstore and that should only be the case if your App doesn't use Bluetooth (or an Apple employee doesn't understand that is does). And from what I've read this values is definitely needed for Bluetooth to function. I've now working the fifth day with this option.

@emericg
Copy link
Owner

emericg commented Dec 16, 2023

It made zero difference in my testing, and the doc still says for iOS only.
But truth be told I don't really care enough to go against this, so I've added this line to the plist, we'll see if anyone report an actual difference in behavior...

@emericg emericg added the help wanted Extra attention is needed label Dec 16, 2023
@fabiang
Copy link

fabiang commented Dec 23, 2023

Tested once again with build 7233199927 and can confirm it's working.

@NathanBnm
Copy link

I have the same issue with the last build (https://github.com/emericg/WatchFlower/actions/runs/7233199927)
Capture d’écran 2024-01-03 à 14 34 07
Capture d’écran 2024-01-03 à 14 34 28

@fabiang
Copy link

fabiang commented Jan 3, 2024

I removed the permission manually and now I'm unable to get it working again. Very weird.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants