简体   繁体   中英

Persistent Multipeer Connectivity Pairing

Using the Multipeer Connectivity framework, is there a way to have devices remember who they paired with in the past? So that confirming the pairing is required only once and further connections can be made without explicit confirmation.

Not a bulletproof approach, but you could store the Device Name of the previously connected peers. Device Names are not guaranteed to be unique, possibly introducing errors or security vulnerabilities, but it might do in a pinch.

you can assign a unique name to each device by appending a random string to the end of each name and displaying only the part that do not have that string.

That way you can store with NSDefaults by example the connected device name and call a function on viewWillappear that search for peers and then connect to a remembered device if needed

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM