ExternalAccessory framework broken on iOS 11

We produce an IAP2 Bluetooth accessory. On the iOS 11 GM, the InputStream provided by the accessory's EASession frequently hangs, rendering our app unusable (we rely on low latency I/O with the accessory). The hangs occur regardless of whether we schedule the stream in a RunLoop or use polling. It appears to be related to the `hasBytesAvailable` property/stream event.


When using RunLoop scheduling, we attempt to read an arbitrary amount of data from the InputStream after consuming the `hasBytesAvailable` stream event. The first read works as expected, then one of the following occurs:

  1. no more `hasBytesAvailable` events are fired
  2. `hasBytesAvailable` only fires again after a seemingly random delay


When polling, we read from the stream while the `hasBytesAvailable` property returns true, spinning otherwise. Similarly to the RunLoop approach, the first read appears to succeed. After the first read, one of the following occurs:

  1. The reader thread is hung trying to acquire an NSRecursiveLock (to access `hasBytesAvailable`)
  2. `hasBytesAvailable` never becomes true


I have confirmed that this issue does not occur on iOS 10.3.3 (the same codebase functions perfectly fine).


I have reached out to Apple via MFi support, DTS, and filed a bug report. Can anyone help?


UPDATE 9/27/17 (1/2):

Apple has taken action on our bug report and did confirm that there was some kind of issue with EA. If anyone else has been in contact with Apple, please share your experience here.


UPDATE 9/27/17 (2/2):

I've just finished some testing with the 11.1 Beta. All the issues remain except one: the Bluetooth connection no longer completely dies. The I/O is still unusable.


UPDATE 10/9/17:
Just finished testing the 11.1 Beta 2 (15B5078e). No improvements.


UPDATE 10/30/17:
Other users here are reporting that this same sort of behavior occurs when using the Lightning connector.

iOS 11.2 Beta improves things, but only slightly. The IAP connection still frequently hangs.

Autel: Could you get an ATS log from both an 11.2 and an 11.1 device with everything else being the same? It would be interesting to see what may have changed between versions. Maybe 11.2 is doing something new but still within spec, which existing iAP2 stacks aren't expecting.


UPDATE: 11.2.5beta4 appears to have solved the issue.

11.2.5beta4 has fixed all of our "zeroed out data bytes" issues. We do still see intermittent accessoryd crashes however.

iOS 11.2.5 beta 4 build 15D5054a fixes "all bytes data is changed to 0x00"

What the phenomenon of the intermittent accessoryd crashes?

11.2.5 is the latest public release - you're in the beta forums..


User-centric queries/comments such as this are perhaps best put to AppleCare's public community support forums, Apple's twitter support account and/or Apple’s YouTube Support Channel vs. risking off-topic here in the DevForums, thanks and good luck.


https://support.apple.com/


Users can feedback via http://www.apple.com/feedback/ - Individuals using betas are free to use the Feedback Assistant; Devs can use the 'Report Bugs' link, below right.

I was having problems with EAAccessoryManager.shared().connectedAccessories returning empty array. I solved it by specifying the device's protocols in UISupportedExternalAccessoryProtocols in info.plist. The names must match the protocols returned from the device, I found that wildcard * doesn't work.

ExternalAccessory framework broken on iOS 11
 
 
Q