Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've been running into this too and it appears to be a bug in Core Bluetooth's XPC communication:</p> <pre><code>2013-03-22 14:49:24.652 Buggy[985:907] Connecting to peripheral &lt;CBConcretePeripheral: 0x1dd4e150 UUID = (null), Name = "iPhone 5 #003014", IsConnected = NO&gt; 2013-03-22 14:49:24.659 Buggy[985:907] CoreBluetooth[WARNING] Unknown error: 311 2013-03-22 14:49:24.661 Buggy[985:907] Failed to connect to peripheral &lt;CBConcretePeripheral: 0x1dd4e150 UUID = (null), Name = "iPhone 5 #003014", IsConnected = NO&gt; 2013-03-22 14:49:24.689 Buggy[985:907] Discovered peripheral &lt;CBConcretePeripheral: 0x1dd644d0 UUID = (null), Name = "iPhone 5 #003014", IsConnected = NO&gt; with advertisement data { kCBAdvDataLocalName = "iPhone 5 #003014"; kCBAdvDataServiceUUIDs = ( "Unknown (&lt;b2e74c08 96094371 a8f0978c 655700ea&gt;)" ); }, RSSI: -50 2013-03-22 14:49:24.692 Buggy[985:907] Connecting to peripheral &lt;CBConcretePeripheral: 0x1dd644d0 UUID = (null), Name = "iPhone 5 #003014", IsConnected = NO&gt; 2013-03-22 14:49:45.035 Buggy[985:110b] CoreBluetooth[ERROR] XPC connection interrupted, resetting 2013-03-22 14:49:45.050 Buggy[985:907] Central manager updated state to: 1 2013-03-22 14:49:45.116 Buggy[985:907] Central manager updated state to: 4 2013-03-22 14:49:47.271 Buggy[985:907] Central manager updated state to: 5 </code></pre> <p>After this point things started working again, at least until the error 311 loop struck again a few minutes later.</p> <p>Here's a workaround that's been reliable for me:</p> <pre><code>// In centralManager:didFailToConnectPeripheral:error:, ARC enabled if (error.code == 0) { self.centralManager.delegate = nil; self.centralManager = nil; // Remove all references to any peripherals you've been interacting with [self.peripherals removeAllObjects]; /* Some delay (more than the next iteration of the runloop, less than 2 seconds) is required in order to: * • Allow ARC to drain the autorelease pool, ensuring destruction of the centralManager * • Allow Core Bluetooth to turn off the radio. * * This means that this workaround might not work if: * • Your code has another active central manager somewhere * • Another app is using BLE (in theory; I haven't tested this) */ double delayInSeconds = 2.0; dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ self.centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:dispatch_get_main_queue()]; [self startScanning]; }); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload