Xcode 中的 iPhone 模拟器是否支持低功耗蓝牙?

时间:2023-05-02
本文介绍了Xcode 中的 iPhone 模拟器是否支持低功耗蓝牙?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我正在新的 Mac mini 上尝试一些 iOS 测试应用程序,它支持蓝牙低功耗.CoreBluetooth 框架用于这些.但是,我无法让蓝牙在 iPhone 模拟器中工作,这是 Xcode 的一部分.

I'm trying some iOS test applications on the new Mac mini, that supports Bluetooth Low Energy. The CoreBluetooth framework is used in those. However, I'm not able to get Bluetooth working in the iPhone simulator, that is part of Xcode.

当我分配一个新的 CBCentralManager,centralManagerDidUpdateState:接收CBCentralManagerStatePoweredOff,代表蓝牙当前已关闭.

When I allocate a new CBCentralManager, centralManagerDidUpdateState: receives CBCentralManagerStatePoweredOff which stands for Bluetooth is currently powered off.

我第一次运行文本应用程序时,打开了一个框,看起来非常有问题(仅使用了语言变量,而不是实际文本)并带有两个按钮.第一个引导我进入设置面板,其中有一个启用蓝牙的选项.但是,在我告诉它启用蓝牙后,它只显示旋转动画,既不会完成也不会取消.即使在重新启动 Mac 后,仍然只有旋转动画.盒子也打不开了.

The first time I ran the text application, a box was then opened up that looked pretty bugged (only language variables were used, not the actual texts) and with two buttons. The first led me to the settings panel where there was an option to enable Bluetooth. However, after I told it to enable Bluetooth, it just shows the spinning animation, and it won't either complete or cancel. Even after rebooting the Mac, there is still only the spinning animation. The box also does not open up anymore.

本质上,我认为 iPhone 模拟器应该支持蓝牙低功耗.否则,在模拟器的设置应用程序中有一个选项并没有真正意义.此外,中央管理器状态是 CBCentralManagerStatePoweredOff 但不是 CBCentralManagerStateUnsupported 代表平台不支持低功耗蓝牙.这也带来了支持的希望.

Essentially, I think that the iPhone simulator should support Bluetooth Low Energy. Otherwise, it does not really make sense that there is an option in the settings application on the simulator. Also, the central manager state is CBCentralManagerStatePoweredOff but not CBCentralManagerStateUnsupported which would stand for The platform doesn't support Bluetooth Low Energy. This gives also hope that support could exist.

  • iPhone 模拟器是否支持低功耗蓝牙?
  • 如果是,我该如何启用它?

推荐答案

模拟器 确实支持低功耗蓝牙 (4.0).唯一的问题是,即使你有一台内置 BLE 的计算机,你也无法与它一起使用模拟器,因为(我认为)你占用了 BLE 上的可用性以供其他设备发现你的计算机,从而限制了Mac 的功能.

The simulator does support Bluetooth Low Energy (4.0) according to this appnote from Apple. The only problem is that even if you have a computer with BLE inside, you will not be able to use the simulator together with it, because (I think) you occupy the availability on BLE for other devices to discover your computer, thereby restricting the functionality of the Mac.

所以,如果你自己去买一个 BLE USB 加密狗,你就可以在模拟器中使用它.

So if you go get yourself a BLE USB dongle you will be able to use it in simulator.

从@JoeShaw 添加信息:

Adding information from @JoeShaw:

不幸的是,iOS 7 的模拟器似乎不再支持 Core Bluetooth.参考:doubleencore.com/2013/09/whats-new-in-bluetooth-le-ios-7.此外,链接的技术说明似乎已被删除.

Unfortunately it appears as though Core Bluetooth support has been dropped from the simulator for iOS 7. Reference: doubleencore.com/2013/09/whats-new-in-bluetooth-le-ios-7. In addition, the linked technote seems to have been removed.

这篇关于Xcode 中的 iPhone 模拟器是否支持低功耗蓝牙?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

上一篇:我应该在 ARC 的 init 方法中引用 self.property 吗? 下一篇:对 ARC 下对象的弱引用 (__unsafe_unretained) 的 NSArr

相关文章

最新文章