List (and connect to) Bluetooth devices from within iOS App

吃可爱长大的小学妹 提交于 2019-12-08 04:54:54

问题


I have a device that broadcasts data via bluetooth. It is MFI certified and I already have an application on the AppStore that communicates with it, using the External Accessory Framework.

The problem is that my application assumes the device is already paired.

Is there a way to enumerate all such devices within reach and allow the user to select (and therefore pair) to one of the devices in the list?


回答1:


No, you can not do this unless two criteria are first met.

  1. Your device must be a Bluetooth Low-Energy device.
  2. The device must have the Bluetooth 4.0 integrated chip which, at the moment, is just the iPhone 4S and the New iPad.

These devices, if operating in the low-energy mode, can be discovered and paired through the CoreBluetooth framework. There is no walk-through form of documentation on this framework, but if you are a seasoned iOS developer, you should be able to figure out how to use the framework through the cut-and-dry framework docs.

As mentioned, information regarding the MFi program and hardware development is locked down under an Apple NDA. However, the information regarding pairing to these devices in this manner is readily available through information in Apple's own documentation.




回答2:


In IOS 6.0, they introduced showBluetoothAccessoryPickerWithNameFilter:completion:

I haven't had much success with it (when it does find devices, they become lost a few seconds later, but this may be an issue with my code).



来源:https://stackoverflow.com/questions/9775645/list-and-connect-to-bluetooth-devices-from-within-ios-app

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