Session immediately invalidated when using BLE background mode

Hello everyone,

I have encountered an error when trying to enable BLE background mode of the third-party NI example application.

I have done that by replacing the

configuration = try NINearbyAccessoryConfiguration(data: configData)

with

configuration = try NINearbyAccessoryConfiguration(accessoryData: configData, bluetoothPeerIdentifier: peerIdentifier)

I have additionally expanded the List.plist with

Required background modes: App communicates using CoreBluetooth

Or rather, central-bluetooth

When starting the session, iPhone 12+ Pro Max (iOS 16+) device immediately calls invalidateSession with the error invalidSession. configData is identical for both cases, and implementation on peripheral device has not been changed. Important thing to note here is that for the non-background mode, third-party accessory and iPhone device are able to range just fine.

Do you have any recommendations or advice how we can try to solve this, or what might be an issue?

Thank you in advance, Aleksa and OBLO Living development team.

Replies

Hello ShareLoc,

I have exactly the same problem as you. Did you find any fixes? I found that if i've removed the peeridentifier from the function NINearbyAccessoryConfiguration, the configuration data is working and the session is becoming valid. Hope you have a solution for me :)

Best regards.