Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS CBPeripheral Services not Being Updated

I am having some trouble with a CBPeripheral that has it's services updated: my physical device has a button that updates the advertising services but my app still reads the old services in the delegate method didDiscoverServices.

Although when I discover the peripheral in didDiscoverPeripheral, I can see the services are up-to-date there.

If I run the app again, the old services are still there! It seems the only way to get my app to discover the new services is turning the Bluetooth off and on again. Even uninstalling/reinstalling my app is not enough.

Does iOS cache the services forever? Is there a way to reset/erase the cache?

like image 428
marcelosalloum Avatar asked Nov 17 '15 12:11

marcelosalloum


1 Answers

have you tried this When you call the scanForPeripheralsWithServices:options: method of the CBCentralManager class to discover remote peripheral’s that are advertising services, your central device uses its radio to listen for advertising devices until you explicitly tell it to stop

Ref: Best Practices for Interacting with a Remote Peripheral Device

like image 165
Neo Avatar answered Oct 18 '22 19:10

Neo