Does the iPhone simulator in Xcode support Bluetooth Low Energy?

前端 未结 6 1558
抹茶落季
抹茶落季 2020-11-27 04:12

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 B

相关标签:
6条回答
  • 2020-11-27 04:27

    I've been working on a BLE app for the past week and can say with confidence that no, the simulator does not support BLE unless the mac that your using has BLE(Macbook Air) - but even then i'm not 100% sure how to enable this(most likely by just turing on BLE on your mac and on the simulator).

    If you don't have a BLE enabled mac, have to find yourself a 4s to do testing with!

    0 讨论(0)
  • 2020-11-27 04:29

    I've found that Apple writes in their own samples that the simulator cannot be used to test Core Bluetooth-based applications.

    Important: This project requires a Bluetooth LE Capable Device (Currently only the iPhone 4S) and will not work on the simulator.

    0 讨论(0)
  • 2020-11-27 04:35

    According to http://www.doubleencore.com/2013/09/whats-new-in-bluetooth-le-ios-7/, Core Bluetooth support has been dropped from the simulator as of iOS 7. I haven't figured out why yet, but it means you will need to test on real hardware in the future.

    It also appears as though Apple has removed Tech Note 2295, as I get redirected when I hit the URL.

    0 讨论(0)
  • 2020-11-27 04:41

    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.

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

    EDIT: Adding information from @JoeShaw:

    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.

    0 讨论(0)
  • 2020-11-27 04:43

    Actually I tried in the simulator and does not work. The simulator does not recognize if you have a Bluetooth 4.0 in your computer but if you are using Command line tool projects in Xcode then it works. just for the cases you want to create something in Command line tool.

    0 讨论(0)
  • 2020-11-27 04:54

    I have been using the simulator to test BLE apps - but you need to be on OSX 10.7. As Wilhelmsen mentioned, you also need a BLE USB dongle. In addition, you need to set an NVRAM setting:

    $sudo nvram bluetoothHostControllerSwitchBehavior="never"
    

    See this Technical Note from Apple for more details on using the simulator to test BLE apps: http://developer.apple.com/library/ios/#technotes/tn2295/_index.html

    0 讨论(0)
提交回复
热议问题