问题
I'm working with MultipeerConnectivity framework in iOS, followed a nice tutorial and it worked well.
I have one question, I have two devices with wifi turned OFF but Bluetooth is ON, for the above approach to work, is it necessary for the two devices to be paired(via bluetooth, manually by the user in iOS settings)?
Will it work even if the devices are not paired manually?
If yes, do I need any special code setup or the above code will just work?(I have tried, for me It didn't work. Might be the OS issues? source1, source2)
If no, Is it possible to do Bluetooth pairing automatically via a program?
Thanks!
回答1:
You do not need for the devices to be paired.
The code I used in my Multipeer Connectivity tutorial required no pairing. This code allowed one iOS device to act as a remote control for another iOS device's camera and send the photos back to the original device using Bluetooth or WiFi. The app works over Bluetooth without any pairing between the two devices.
Hope this helps!
UPDATE
MPC will not work over Bluetooth on iOS 11+
来源:https://stackoverflow.com/questions/48164362/working-with-multipeerconnectivity-in-ios-swift