问题描述
我正在使用iOS中的 MultipeerConnectivity框架,并遵循了一个不错的教程,效果很好.
I'm working with MultipeerConnectivity framework in iOS, followed a nice tutorial and it worked well.
我有一个问题,我有两个设备的wifi已关闭,但蓝牙已打开,要使上述方法起作用,是否需要将这两个设备配对(通过蓝牙,由用户在iOS设置中手动进行配对) ?
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?
如果是,我是否需要任何特殊的代码设置,否则上面的代码将正常工作?(我尝试过,对我而言,它不起作用.可能是操作系统问题吗? source1 , source2 )
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?
谢谢!
推荐答案
您不需要 配对设备.
我在多对等连接教程不需要配对.此代码允许一台iOS设备充当另一台iOS设备的相机的遥控器,并使用蓝牙或WiFi将照片发送回原始设备.该应用程序可以通过蓝牙工作,而无需在两台设备之间进行任何配对.
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.
希望这会有所帮助!
更新
MPC在iOS 11+上无法通过蓝牙工作
MPC will not work over Bluetooth on iOS 11+
这篇关于在iOS Swift中使用MultipeerConnectivity的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!