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

startNotification results in Could not find service with UUID 0001 #1026

Open
markarupert opened this issue Aug 12, 2024 · 12 comments
Open

startNotification results in Could not find service with UUID 0001 #1026

markarupert opened this issue Aug 12, 2024 · 12 comments

Comments

@markarupert
Copy link

I am getting this error on my iOS app. I have been using the plugin for years and this suddenly came up. So I'm not sure what changed.

"Could not find service with UUID 0001 on peripheral with UUID XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"

I am using version 1.7.4.

Here is the start notification code.


service = "0001";
characteristic = "0001";
ble.startNotification(mmaddr,
    service,
    characteristic,
    ot.ioSixNotifyFcn,
    function (e) {
        deviceLog('BLE: startIOSixBLE: Failed to startnotification: ' + mydump(e), function (str) {console.log(str)});
    });
@peitschie
Copy link
Collaborator

Hi @markarupert

Is the problem intermittent, or consistent across all devices? Also, what version were you on previously?

There haven't been many changes to the iOS code for quite some time, but I have found sometimes that iOS updates cause issues like this.

The other thing to try is whether 1.7.5-alpha.0 makes any impact here. I recently added additional logging to the alpha package around service discovery failures, which perhaps could point to more insight as to what's happening here.

@peitschie peitschie added the ios label Aug 13, 2024
@markarupert
Copy link
Author

Thanks for the response.

It is happening on both my devices. It seems like it is a project issue. It previously worked with 1.4.4 but now it isn't. I updated to the latest version and got the same result. It is happening on all my test devices.

I tried updating with:

cordova plugin add [email protected]

It is failing to fetch the plugin.

@peitschie
Copy link
Collaborator

It previously worked with 1.4.4 but now it isn't

Just to double-check my understanding, are you saying that your application no longer works with version 1.4.4 either?

@markarupert
Copy link
Author

Sorry I have been doing some testing.

Yes it does not work with either version.

I have been doing some analysis. I have several apps that use ble central. They are very similar just adjusted from certain markets. Some are working fine.

I installed the alpha version above and here is what looks like the extra logging information.
The Service and characteristic being passed to startNotification is "0001" for both

Does this help:

2024-08-16 14:46:38.504458-0400 GeoWizBiz[1113:343044] registering for notification
2024-08-16 14:46:38.504509-0400 GeoWizBiz[1113:343044] getData
2024-08-16 14:46:38.504544-0400 GeoWizBiz[1113:343044] getUUID
2024-08-16 14:46:38.504588-0400 GeoWizBiz[1113:343044] Malformed UUID:
2024-08-16 14:46:38.506618-0400 GeoWizBiz[1113:343044] readRSSI
2024-08-16 14:46:38.506876-0400 GeoWizBiz[1113:343044] getUUID
2024-08-16 14:46:38.507041-0400 GeoWizBiz[1113:343044] Malformed UUID:

@peitschie
Copy link
Collaborator

Hi @markarupert

The fact this has stopped working with the previous version too makes me suspect either something iOS version related... or potentially iOS has cached some bad service characteristics.

Resetting the iOS BLE cache is a bit painful though, as it requires clearing all data off the device (see https://stackoverflow.com/a/47129088).

I have found this causing issues before, especially when I'm actively developing a peripheral and changing the services/characteristics. Sometimes iOS caches an incorrect discovery payload, and can't be easily convinced that it's no longer applicable (without adding support to the peripheral for the service changed characteristic).

@markarupert
Copy link
Author

Wow, that's drastic and obviously impractical. There must be a better way.

@peitschie
Copy link
Collaborator

@markarupert of course this is impractical as an end-user instruction. The main point of interest here is whether this has any impact on your local situation.

The fact that a previously functional version (1.4.4) is no longer working highly suggests something outside of this plugin is at fault. Until you can figure this out... it's pretty hard to guess what the correct recovery steps are.

2024-08-16 14:46:38.506618-0400 GeoWizBiz[1113:343044] readRSSI
2024-08-16 14:46:38.506876-0400 GeoWizBiz[1113:343044] getUUID
2024-08-16 14:46:38.507041-0400 GeoWizBiz[1113:343044] Malformed UUID:

It's interesting that you're seeing a Malformed UUID here, as the only ID supplied to readRSSI is a device identifier.
Are you certain the scan is picking up a valid device?

@markarupert
Copy link
Author

It does seem to be having trouble with the scan. I got it to work by backing down the version of cordova-ios to 5.1.1.

@peitschie
Copy link
Collaborator

Is there any chance the phone or some other nearby device is sometimes connecting to the device you're scanning for?

There's been no real changes within the plugin that would impact the scanning behaviours for a long time, so I can't really guess why jumping back to cordova-ios 5.1.1 (which is several years old) would have any real impact here.

Certainly a mystery!

@markarupert
Copy link
Author

Sorry for the delay. I confirmed that nothing else is connecting to it. I agree that jumping back does not seem like the correct answer. I am at the point I just have to get my app released and since that worked I went with it. On my next release cycle I will do more research on it.

@peitschie
Copy link
Collaborator

Makes sense. I'll leave the ticket open for a while then... we'll see if anything else interesting crops up in your research when you get time 🙂

@peitschie
Copy link
Collaborator

Hi @markarupert

I wonder if the issue you see here might be connected to #1039.

I've made an update in 1.7.9 (currently alpha) that may improve this situation if it is. If you have time, you can try out the fix by npm install [email protected]

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

No branches or pull requests

2 participants