I want to develop a demo of uwb which can be run across multiple iPhones. In the video of WWDC it is said that for each device, a distinctive NISession is needed. I tried to generate two different NISessions, but I found that the discoveryToken for each session is different. That made me confused because I thought each device should have only one single token. Can anyone tell me how to manage multiple UWB connections at the same time? Thanks in advance.
How to manage UWB connections with multiple devices
You are on the right track. Follow these steps to perform interaction with multiple iPhones:
Create an NISession for each peer you would like to interact with. For example, if you are interacting with two peers, create 2 * NISession objects.
Each NISession will have a unique NIDiscoveryToken associated with it. Share discovery token #1 with peer #1, and share discovery token #2 with peer #2.
When you receive discovery tokens from peers #1 and #2, create 2 * NINearbyPeerConfiguration objects and use them to run sessions #1 and #2, respectively.