問題描述
我正在新的 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模板網!