New Project, Sensor Connect after Resign Active, iOS 11.2.6


I don’t understand what’s magical about the included Xcode project “Scanner” but I am unable to create a new Xcode project that can maintain a connection to the sensor after the app has resigned active in iOS 11.2.6.

In all projects other than the provided Scanner app, on launch I see various External Accessory outputs like:

eaAccessory CoreAccessoryPrimaryUUID = CA0FC4AB-6442-435D-A728-DE4309EFA6E3

And when the app resigns active, I see:

CoreAccessories accessoryInfo for departure = { ...

After this point, the scanner is completely unresponsive until it is replugged.

However, the provided Scanner is somehow able to avoid these External Accessory outputs, and when the application resigns active, there is no CoreAccessory departure and the connection can be successfully resumed when the application becomes active again.

What is happening?


Possibly related:


Other messages I see:

/BuildRoot/Library/Caches/ received an XPC_ERROR_CONNECTION_INVALID error.

Sometimes randomly lots of this message:

2018-02-23 13:19:38.861438-0800 ScannerDebug3[938:72840] ERROR - opening session failed
2018-02-23 13:19:38.861621-0800 ScannerDebug3[938:72840] ERROR - /BuildRoot/Library/Caches/[EASession dealloc] - 190 unable to close session for _accessory=0x1cc01d710 and sessionID=65536
2018-02-23 13:19:38.861914-0800 ScannerDebug3[938:72840] ERROR - opening session failed

And this with arrival/departure:

CoreAccessories accessoryInfo for arrival = {
    ACCExternalAccessoryPrimaryUUID = "95ED09FF-1942-487A-9035-DF2FB9D2972B";
    IAPAppAccessoryCapabilitiesKey = 1;
    IAPAppAccessoryCertDataKey = "908 bytes";
    IAPAppAccessoryCertSerialNumberKey = "15 bytes";
    IAPAppAccessoryDockTypeKey = "";
    IAPAppAccessoryFirmwareRevisionKey = "2.0";
    IAPAppAccessoryFirmwareRevisionPendingKey = "<null>";
    IAPAppAccessoryHardwareRevisionKey = "1.0";
    IAPAppAccessoryManufacturerKey = Occipital;
    IAPAppAccessoryModelNumberKey = ST01;
    IAPAppAccessoryNameKey = "Structure Sensor";
    IAPAppAccessoryProtocolsKey =     {
        "io.structure.control" = 0;
        "io.structure.depth" = 2;
        "io.structure.infrared" = 1;
    IAPAppAccessorySerialNumberKey = 41437;
    IAPAppAccessoryVehicleInfoInitialDataKey =     {
    IAPAppConnectionIDKey = 41754241;


At the moment, it appears that you must be streaming to allow the External Accessory to recover after resigning active.

If I take the provided “Scanner” project and disable (void)startStructureSensorStreaming is also fails to recover the accessory connection when backgrounded.

Additionally, even though sensorDidOutputDepthFrame is marked optional, if you do not implement it, you cannot recover the accessory connection when backgrounded.

I can now make own Xcode project that can maintain a connection to the sensor if-and-only-if I stream from it 100% of the time.


Here is an extremely minimal project demonstrating the problem.

If you comment out [self startStreaming] it is unable recover the connection after resigning active without replugging the sensor.


I decompiled the Structure binary and was looking for a way to manually close the connection before UIApplicationWillResignActive. I tried calling resetConnectionState and deviceDisconnected with no success.

Can this issue be looked into? Replugging the device every few moments is not acceptable and the only workaround (streaming from the device 100% of the time) kills the battery.


This is an issue seen since the introduction of iOS 11. If an app is backgrounded, connection to an accessory is lost.

We have contacted Apple about the issue and are waiting for their reply on how to fix it.

We are also currently looking into why it seems that our Scanner Sample app seems to be less affected by this issue.


The strange thing is that the connection to the accessory can be restored if streaming is active — which explains why the sample app works properly.

If you plug the sensor, start streaming for a bit, stop streaming, then background the app, the accessory is unrecoverable until replug.

Additionally, if I plug the sensor, never initialize its connection, background the app, activate the app, the accessory is still available to connect to.



iOS 11.2.6, iPad (5th gen.):

Occipital’s “Viewer” app from the App Store works fine;

Occipital’s “Structure” app from the AppStore: Sensor’s emitter stays ON when the iPad’s “Home” button is pressed once - so, the app is not active but the Sensor’s emitter continues to be ON, and then “Structure” gets into the infinite “Please connect Structure Sensor” state when it comes back from the background.


Hello Occipital,

Any progress with fixing the iOS 11 bugs?