gpt4 book ai didi

IOS BLE scanForPeripheralsWithServices :options: on Background

转载 作者:行者123 更新时间:2023-11-29 02:31:59 29 4
gpt4 key购买 nike

CentralManager 不在后台扫描 BLE 设备....

我已经在 info.plist 中设置了 UIBackgroundModes, bluetooth-central

也尝试过为这样的服务输入 UUID..

[CentralManager scanForPeripheralsWithServices:@[[CBUUID UUIDWithString:@"0xFFA0"]] options:nil];

(0xFFA0 是服务的 UUID。)

还尝试了 "C337FA9-4DCF-****-77AB-************"; 设备的 UUID。无论我把 UUID 放在服务中。在后台未找到任何设备。

当前台.. scanForPeripheralsWithServices:nil 找到所有设备。但不是 scanForPeripheralsWithServices:someuuids

谁能帮帮我?

最佳答案

1.如果您使用

scanForPeripheralsWithServices:someuuids

必须有一些设备使用此 uuid 通告蓝牙数据包。这可以在前台和后台正常工作

2 如果你使用

scanForPeripheralsWithServices:nil

您可以获得您想要的所有设备,但这在后台时不起作用。

因此,如果您想在后台获取结果,您必须设置您的外设使用 UUID 通告 BLE 数据包。

关于IOS BLE scanForPeripheralsWithServices :options: on Background,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26752981/

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