简体   繁体   English

使用NSNetService在iOS 7上进行蓝牙对等连接

[英]Blutooth Peer To Peer Connection on iOS 7 using NSNetService

I'm trying to get the Objective C++ distributed object model working between iOS and OSX devices. 我正在尝试在iOS和OSX设备之间使用Objective C ++分布式对象模型。 Using WiFi, almost everything is fine; 使用WiFi,几乎一切都很好。 however, with iOS 7 Apple introduced the "includesPeerToPeer" property which should publish an NSNetService over Bonjour using Blutooth. 但是,在iOS 7中,Apple引入了“ includesPeerToPeer”属性,该属性应使用Blutooth在Bonjour上发布NSNetService。 I set the property like this: 我将属性设置如下:

self.netService.includesPeerToPeer = YES;

before calling 打电话之前

[self.netService publish];

This works fine wetween a MAC and any iOS Device running iOS 7 (given, the MAC and the device are paired before). 这在MAC和运行iOS 7的任何iOS设备之间正常工作(考虑到MAC和设备之前已配对)。 However, the devices don't discover themselves over Blutooth. 但是,设备无法通过Blutooth发现自己。

I'm wondering, whether I missed something or anyboldy has a glue, why this is not working. 我想知道,无论我错过了什么还是任何东西都有胶水,为什么这不起作用。

Well, got it. 好吧,知道了。 NSNetServiceBrowser now also has a new property called "includesPeerToPeer". NSNetServiceBrowser现在还具有一个名为“ includesPeerToPeer”的新属性。 When setting this to TRUE immediately after initialisation and before starting the search, devices find themselves. 在初始化之后和开始搜索之前立即将其设置为TRUE时,设备会发现自己。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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