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:
- no more `hasBytesAvailable` events are fired
- `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:
- The reader thread is hung trying to acquire an NSRecursiveLock (to access `hasBytesAvailable`)
- `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.