Reputation: 3718
I am attempting to connect two iPhones using Core Bluetooth. One is running a peripheral, the other a central. It seems the two devices are connected. And every method is getting called in the typical control flow up until peripheralManager:central:didSubscribeToCharacteristic:
does not get called on the peripheral side and peripheral: didUpdateValueForCharacteristic: error:
does not get called on the central side. However, If I call readValueForCharacteristic:
it works and grabs the first value, but it does not seem to register for notifications and we get an "unknown error 2" in the updateValueForCharacteristic: method. I have been going through all the sample code I could find (heart monitor, business card, etc.) and my code is the exact same yet I cannot get it to work.
Anyone have any ideas on what the issue could be?
Upvotes: 1
Views: 2126
Reputation: 3718
I resolved this a while ago but I thought I would post a solution since it may be useful to people going forward... The solution to this problem had to do with the bluetooth caching. Basically, the issue was that something had cached improperly... I restarted my phone, which clears the BLE cache, and did the same for the phone that I was testing it with and voila it worked. I recommend if people have these sorts of BLE issues (especially if you have been registering your phone as both a peripheral and a central for similar code) that you clear your cache by restarting!
Upvotes: 3