我正在开发一个 iOS 应用程序
,我想在其中列出蓝牙设备名称并连接到其中任何一个设备并传输数据(消息)。
现在我正在使用 MultiPeerConnectivityFramework
,它使用 MCBrowserViewController 来发现附近的设备,但不幸的是我没有在 MCBrowserViewController 中获得任何设备名称。这是我的代码
-(void)setupPeerAndSessionWithDisplayName:(NSString *)_displayName{
self.peerID = [[MCPeerID alloc] initWithDisplayName:_displayName];
self.session = [[MCSession alloc] initWithPeer:self.peerID];
self.session.delegate = self;
-(void)setupMCBrowser{
self.browser = [[MCBrowserViewController alloc] initWithServiceType:@"chat-files" session:self.session];
最佳答案
不幸的是,MultipeerConnectivity 是 Apple 特定的框架,不适用于 Android 设备。
据我所知,使用蓝牙进行此类跨平台连接是不可能的。如果您想使用不在前台的应用程序,则尤其如此。
关于ios - 通过蓝牙 iOS 设备之间的连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32559471/