卓悦不是广告了BT [英] Bonjour not advertising over BT

查看:254
本文介绍了卓悦不是广告了BT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在敲我的头这最后一个星期左右。我已经通过以下资源了:

I've been banging my head against this for the last week or so. I've already gone through the following resources:


  • 计算器:卓悦通过蓝牙WITHOUT的GameKit? (3844189)

  • 计算器:如何卓悦在蓝牙工作(3350094)

  • 计算器:使用IOS的GameKit的卓悦蓝牙与其他平台(8070998)

  • 技术问答集; A QA1753 - 苹果开发者

  • WiTap示例应用程序

  • SRVResolver示例应用程序

  • DNSSDObjects示例应用程序

我使用的Mac OS 10.7,X code ++ 4.5,一个iPhone 4的iOS 6和一个iPad 1与iOS 5.1.1。

I'm using Mac OS 10.7, Xcode 4.5, an iPhone 4 with iOS 6, and an iPad 1 with iOS 5.1.1.

我的问题是这样的:我修改当前使用的GameKit的同级选择器一台iPad和知识产权之间连接的应用程序{磨练| OD触摸}。我们要修改这个使用卓悦通过蓝牙,而不是因为我们有问题与重新连接使用的GameKit如果连接丢失的设备。我用dns_sd.h API来取得了一些成功,并已经得到了服务,宣传和解决通过WiFi,但即使我路过kDNSServiceFlagsIncludeP2P我没有得到过任何蓝牙成功。

My problem is this: I am modifying an application that currently uses GameKit's peer picker to connect between an iPad and a iP{hone|od touch}. We want to modify this to use Bonjour over Bluetooth instead because we've had issues with reconnecting the devices using Gamekit if the connection is lost. I've used dns_sd.h API to some success and have gotten the service to advertise and resolve over wifi, but even though I am passing kDNSServiceFlagsIncludeP2P I am not getting any success over bluetooth.

我想可能是蓝牙的Bonjour需要建立PAN设备间了,但即使是配对的iPad的iMac和浏览的DNS-SD服务给我什么...和iPhone将无法配对到iPad反正。

I thought possibly Bluetooth Bonjour need a PAN established between devices already, but even pairing the iPad to the iMac and browsing for DNS-SD services gives me nothing...and the iPhone won't pair to the iPad anyway.

推荐答案

我刚刚完成在过去24小时在自己的应用程序解决这一点。我用从OS X的示例应用程序DNSSDObjects的核心类。我只有改变三行code的增加对蓝牙的支持。这在我的iOS应用程序的伟大工程。

I just finished solving this in my own app in the last 24 hours. I used the core classes from the OS X sample app DNSSDObjects. I only had to change three lines of code to add support for bluetooth. This works great in my iOS app.

在DNSSDBrowser.m,调用 DNSServiceBrowse 需要有 kDNSServiceFlagsIncludeP2P 传递的第二个参数。

In DNSSDBrowser.m, the call to DNSServiceBrowse needs to have kDNSServiceFlagsIncludeP2P passed in for the 2nd parameter.

在DNSSDRegister.m,调用 DNSServiceRegister 需要同样的变化。

In DNSSDRegister.m, the call to DNSServiceRegister needs the same change.

在DNSSDService.m,调用 DNSServiceResolve 也需要同样的变化。

In DNSSDService.m, the call to DNSServiceResolve also needs the same change.

如果您想限制自己只是蓝牙,并没有无线网络,那么同样的三线code应该更新,所以第三个参数的 kDNSServiceInterfaceIndexP2P 而不是 kDNSServiceInterfaceIndexAny

If you want to limit yourself to just bluetooth, and not WiFi, then the same three lines of code should be updated so the 3rd parameter is kDNSServiceInterfaceIndexP2P instead of kDNSServiceInterfaceIndexAny.

这篇关于卓悦不是广告了BT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆