iPhone: How to erase/wipe out bluetooth 4.0 data

2019-05-03 07:16发布

问题:

I am having some major trouble with my Bluetooth Low Energy application sometimes dont manage to connect to my device (described in thread).

I need to wipe out all stored data from previous connections before running my application, and as far as I know, this can only be done by rebooting the phone. Is there any other way, preferably programatically, to do this?

Thank you

回答1:

I am having the same issue and have found the steps to reproduce it.

It is 100% reproducible when you transmit data to the peripheral with

[peripheral writeValue:x forCharacteristic:y type:CBCharacteristicWriteWithoutResponse];

while the peripheral goes out of range and disconnects. After this happens no more services are returned by BLE devices, and only a reboot fixes the problem. This doesn't happen if the peripheral goes out of range and comes back in without transmitting data to it or if

[peripheral writeValue:x forCharacteristic:y type:CBCharacteristicWriteWithResponse];

is used...

Other disconnects don't seem to affect it, such as powering down the peripheral and powering it back up while in range even while transmitting data...

I know this isn't an answer but it looks like I can't comment for some reason.

Hope this helps debugging though.