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.

Replies

Which device w/what version BT are you testing on?

We are experiencing weird behaviors too in our EA/MFi implementations.

Most of the time the accessoryd reports a timeout when attempting to retrieve the connected accessory.

And when we put our app in background, the EA streams are being closed when the app is move forground, and EA session can't be recovered properly.

Updated original post

My app have the same problem. When the app put in background. The accessory disappear in the accessory list of iOS.

The same issue that we're expering too, when we connect iphone(iOS11) with our hardware(HeadUnit) via iAP2 USB accessory, the apps have to be in foreground in order to playback audio in hardware. But there is no need in iOS10.

We have the same issue, we changed the code to run in foreground which solved many incidents, but still experiencing accessory unexpected disconnection and then failure to initiate new sessions to the accessory

We still haven't seen any progress on this issue as of iOS 11.1 Beta 5. I hate to keep bumping a post but we're really in a bind.

We have the same problem... our device is worthless to our customers until this gets fixed. We are recommending that they don't update iOS or use an Android device.

We are having similar problems over lightning connected MFi devices. We are a software company that works with multiple hardware accessories and it is effecting all of the devices.

Our development team is experiencing identical issues on all MFi Devices that we support utilizing the Lightning Connector. We cannot confirm if this effects Bluetooth MFi Devices as well at the moment -- but our customers are complaining and major warehouses, hospitals, retail giants, and other tier-1 customers are nearly dead in the water right now!



We work with MFi Scanners, Printers, credit card readers, etc from manufacturers like Honeywell, Infinite Peripherals, Code Corp, Star, Zebra, Epson, Socket Mobile, and many more.



This is an absolute top-priority to get this fixed IMMEDIATELY!

We are still seeing the issue on iOS 11.03 with IAP2 over Bluetooth where if our App gets moved to the background we lose Bluetooth connectivity. On some devices, when moved back to the foreground, Bluetooth will reconnect. On other devices it does not. Same up works in background on iOS 10.x

If you haven't, please make sure to open a bug report with Apple. I have had one open for several months, and it was marked as a duplicate. The original issue is now marked as closed, but it can't hurt.


Apple treats duplicate reports with higher priority.

I have just tested with iOS 11.2 Beta 1 and it is a step in the right direction. The app works.... sort of. Any intensive use of the IAP2 connection still causes hangs, but the connection does not die and it eventually recovers.

I wish I had a workaround to offer, but wanted to chime in that we are experiencing this issue too. Most of the time, the issue manifests itself when our app returns to the foreground and we cannot write to the output stream because hasSpaceAvailable is false. But we are also experiencing connectedAccessories for EAAccessoryManager sharedAccessoryManager not returning any accessories even though the accessory is connected and listed in the About section of Settings. I'll file a bug report too so we can hopefully draw some attention to this and get it resolved.

hello guys ,


is ios 11 still supporting iAP1 devices ?


thank you