CoreBluetooth stopadvertising不会停止 [英] CoreBluetooth stopadvertising does not stop

查看:83
本文介绍了CoreBluetooth stopadvertising不会停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用CoreBluetooth的iOS应用.

I have an iOS app that uses CoreBluetooth.

它可以做广告并且可以很好地连接.

It is able to advertise and be connected too just fine.

当我在外围设备管理器对象上调用stopAdvertising时,它不会停止广告.我等待了大约10分钟,它仍然显示在我的蓝牙扫描仪中,并且我仍然可以连接到它.

When I call stopAdvertising on the peripheral manager object, it doesn't stop advertising. I waited for about 10 minutes and it still shows up in my bluetooth le scanner and I can still connect to it.

我的iPhone是装有最新软件的iPhone X.

My iPhone is an iPhone X with the latest software.

我没有发现可以检测到的错误,并且isAdvertising保持不变.

I get no errors that I can detect and isAdvertising stays true.

有人知道为什么它不会停止广告吗?

Anyone know why it won't stop advertising?

推荐答案

以我在iOS上使用GATT的经验,我注意到在调用 stopAdvertising 方法后,我必须调用 removeAllServices 方法(也可以按照官方文档这里).

In my experience with GATT on iOS, I notice that after calling stopAdvertising method I have to call removeAllServices method too (it remove just your services as mentioned in official docs here).

但是,如果有任何客户端正在扫描我的GATT服务器或已连接到该服务器,则我必须等待它们停止监视它,以使其不再被发现.

But, if there are any clients scanning my GATT server or connected to it, I have to wait that they stop watching it to be not discoverable anymore.

这篇关于CoreBluetooth stopadvertising不会停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆