Bluetooth Dongle and iOS Simulator

浪尽此生 提交于 2019-12-25 08:00:10

问题


I have bought an IOGEAR GBU521 bluetooth dongle as per the instruction on Apple's technote:

http://developer.apple.com/library/ios/#technotes/tn2295/_index.html

I have also configured it as instructed and I'm trying to get the temperaturesensor demo to work but the Bluetooth under settings never seems to turn on (keeps spinning). Looking at the console, here is what I see:

2012-11-02 4:17:08.114 PM Preferences[862]: BTM: setting discoverable status enabled 2012-11-02 4:17:08.114 PM Preferences[862]: BTM: setting connectable enabled 2012-11-02 4:17:08.115 PM Preferences[862]: BTM: enabling device scanning 2012-11-02 4:17:08.115 PM Preferences[862]: BTM: failed to start scanning with error 111

Any thoughts? I've seen people ask about this but has anyone got this approach to work?

Best,


回答1:


Throw away the IOGEAR and pick up a Cirago BTA8000.

I bought the IOGEAR you mention, in addition to the Cirago BTA8000, and the MediaLink 4.0 adapter. Turns out that anything based on the Broadcom chip won't work despite my MacBook having the exact same one built in, which means the MediaLink and IOGEAR don't work. My Cirago shipment just arrived this morning, and the Bluetooth slider in the iOS Simulator flicks to "ON" in less than a second.

If you want to experiment, I'd love to hear if other non-Broadcom chips work too.




回答2:


I just bought a GBU521 from amazon to upgrade the BT in my MacBook8,3

I had the same problem of it not showing up. Reading the same article you referenced (TN2295) I did a sudo nvram bluetoothHostControllerSwitchBehavior="always" which tells the system to ALWAYS switch to a bluetooth controller if one is plugged in.

The default option:

when a new HCI is connected, the built-in driver only disconnects from the built in HCI and attaches to the external HCI if the new module is not an Apple module.

I presume that because the vendor IDs matched (0xa5c) that it was not switching over to the new dongle. Setting it to always causes OSX to always switch to a new BT adapter. This is confirmed by the following statement in TN2295:

Open the System Information application to verify that the system Bluetooth driver is matched to the built-in Bluetooth host controller interface (HCI). For the Hardware->Bluetooth setting, verify that the Vendor ID is "0x5AC".

Rebooting after the nvram update and I was able to re-pair all of my devices without incident.

HOWEVER this will not work for iOS BT LE development due to the following statement in TN2295:

If the system Bluetooth controller is matched to the Bluetooth LE USB adapter, then the iOS simulator will not be able to use the external Bluetooth controller for Bluetooth LE services.




回答3:


Actually, you can mod the Info.plist inside the BroadcomBluetoothHostControllerUSBTransport.kext found here:

/System/Library/Extensions/IOBluetoothFamily.kext/Contents/PlugIns/BroadcomBluetoothHostControllerUSBTransport.kext/Contents/Info.plist...

Just copy another Broadcom dictionary and modify it or use the following additon to the Info.plist. You'll need to do this as an admin (i.e. sudo nano or vi this file after making a copy of the original).

    <key>Add an appropriate name here</key>
    <dict>
        <key>CFBundleIdentifier</key>
        <string>com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport</string>
        <key>IOClass</key>
        <string>BroadcomBluetoothHostControllerUSBTransport</string>
        <key>IOProviderClass</key>
        <string>IOUSBDevice</string>
        <key>idProduct</key>
        <integer>8680</integer>
        <key>idVendor</key>
        <integer>2652</integer>
    </dict>

May need to reboot after the edit. Did this on 2012 MacBook Pro, ran XCode, and it allowed access to the Bluetooth dongle in iOS Simulator!

I hope this helps!



来源:https://stackoverflow.com/questions/13202916/bluetooth-dongle-and-ios-simulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!