iOS 6 CoreBluetooth Pairing / Forgetting (2 questions)

一曲冷凌霜 提交于 2019-11-29 00:24:03

问题


We have a bondable (when we connect we are asked to Pair, see question 2) Bluetooth 4.0 peripheral that we have manufactured and have written an iOS app for.

Question 1

Is it possible in iOS 6 with CoreBluetooth to remove our peripheral from the iOS Bluetooth Settings from within our app or is this restricted to only going to iOS Settings / Bluetooth / Our Peripheral and "Forget this device".

What we are trying to do is when we remove our peripheral from within our app, we expect this peripheral to be removed from the iOS Bluetooth list as well.

Question 2

My second question is, does iOS SDK provide a way to determine if a user has chosen "Pair" or "Cancel" on the Pairing request alert? As of now, we determine the user pressed pair by reading our services / characteristics when the device is connected.


回答1:


  • Question 1

No, I really dont think so. Clearing it through settings is the only possible way.

  • Question 2

The centralManager delegate has callbacks for both failed and successfully connected peripheral, so I would listen to them to check if user cancelled or not: didConnectPeripheral and didFailToConnectPeripheral




回答2:


When you click 'cancel' on the bonding dialog iOS will call the delegate method 'centralManagerDidUpdateState' with the state being 'CBCentralManagerResetting'. If you click pair then the command will proceed normally.



来源:https://stackoverflow.com/questions/12657940/ios-6-corebluetooth-pairing-forgetting-2-questions

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