本文介绍了在CBPeripheralManager中,如何知道用户在尝试配对时是否按下了“取消"按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用CBPeripheralManager在iPhone和设备之间建立BLE连接.

I'm making BLE connection between iPhone and device with CBPeripheralManager.

如果Central尝试与外围设备配对,则会弹出蓝牙配对alertController,用户可以选择要使用的蓝牙配对.他们中的大多数人都会按下连接按钮.

If Central tried to pair with peripheral, Bluetooth pairing alertController pops up and user can choice which one there're going to use. Most of them will push a connect button.

但是有什么方法可以知道用户何时按下取消按钮吗?

But is there a way to know when user push a cancel button?

Delegate API会很好,但我找不到它.

Delegate API would be good but I couldn't find it.

推荐答案

我不确定,但是 didFailToConnectPeripheral 方法是处理您的案件的好地方.

I'm not sure, but maybe didFailToConnectPeripheral method of CBCentralManagerDelegate is a good place to handle your case.

这篇关于在CBPeripheralManager中,如何知道用户在尝试配对时是否按下了“取消"按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 05:43