gpt4 book ai didi

ios - 我可以使用 CBPairingAgent unpairPeer : to remove the bluetooth device from paired

转载 作者:行者123 更新时间:2023-11-29 00:50:07 25 4
gpt4 key购买 nike

我想从系统设置或“取消配对”中删除已配对的蓝牙设备。我知道苹果不提供公共(public) api 来执行此操作,所以我尝试了私有(private)类 CBPairingAgent。我在 github 上找到了标题 CBCentralManager.h CBPairingAgent.h这是我的代码:

- (void)unpair:(CBPeripheral *)peer {
id agent = [self.centralManager valueForKey:@"sharedPairingAgent"];
// [agent performSelector:@selector(setDelegate:) withObject:self.centralManager];
[agent performSelector:@selector(unpairPeer:) withObject:peer];
}

此代码运行没有错误,但对外围设备也没有任何影响。

有人能指出我正确的方向吗?或者建议更好的方法

最佳答案

如果进程有足够的权限,则用于删除设备配对的私有(private) API 才会起作用,这只能在 JB 设备上实现。

在 JB 上,我添加了以下权利(可在“设置”和“SpringBord”中找到):

  • com.apple.BTServer.allowRestrictedServices
  • com.apple.BTServer.le
  • com.apple.BTServer.programmaticPairing

关于ios - 我可以使用 CBPairingAgent unpairPeer : to remove the bluetooth device from paired,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38226367/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com