How to set visionAssistanceEnabled flag in NISession

I would like to get the direction value from NISession, from the document, it said "On iPhone, it’s possible to receieve direction for nearby third-party accessories in sessions that enable visionAssistanceEnabled"

but i have no idea how to enable it as there is no member belong to NISession, plus deviceCapabilities is only available in IOS 16+

anyone has idea?

You need to set flag isCameraAssistanceEnabled = true on the NINearbyAccessoryConfiguration (or NINearbyPeerConfiguration if you are connecting to another iPhone or Apple watch).  This configuration you will use to start NISession like this:

niSession.run(configuration)

Note that the flag isCameraAssistanceEnabled is available only from iOS 16 as you mentioned but you do not need it to get the direction from the NISession. It is used only to improve spatial awareness of the NearbyInteractions framework, and everything will work without it.

Take a look at the sample projects in the documentation:
https://developer.apple.com/documentation/nearbyinteraction/implementing_interactions_between_users_in_close_proximity
https://developer.apple.com/documentation/nearbyinteraction/implementing_spatial_interactions_with_third-party_accessories

How to set visionAssistanceEnabled flag in NISession
 
 
Q