- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在制作一个使用 Core Bluetooth 的 iOS 应用程序,并定期检查外围设备是否还在。我的问题是,当我关闭广告设备(甚至完全关闭蓝牙)时,我的中央设备在我调用 retrievePeripheralsWithIdentifiers 时仍然返回 CBPeripheral 对象。一旦它不再做广告,我需要它准确地不返回这个外围设备。提前致谢!
最佳答案
retrievePeripheralsWithIdentifiers
查看 Core Bluetooth 数据库,看看它是否可以找到具有指定标识符的外围设备,无论来自该外围设备的广告当前是否可见。这允许您发出与以前见过并可能再次见到的外围设备的连接(Core Bluetooth 编程指南中描述的“锁定”场景是您可以使用它的一个示例)。
要查看外围设备是否正在广播,您需要调用 scanForPeripheralsWithServices
,为 CBCentralManagerScanOptionAllowDuplicatesKey
指定 YES
并保持您自己的可见表外围设备,当你有一段时间没有看到广告时,它们就会老化。
关于ios - Core Bluetooth iOS - 检索虚假外设,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27209326/
我试图弄清楚接受 OpenID 登录的网站如何无法通过简单的主机文件更新来指向伪造的 OpenID 提供商。 假设我想侵入 Joe Smith 的帐户,在这个例子中,假设他的 OpenID 提供商是
#include #include #include #include #include #include #include #include #include #include #define P
根据此讨论 - "RESTful API - Correct behavior when spurious/not requested parameters are passed in the req
如果编译为 Cand C++ 源代码,这个简单的代码片段会使用 g++ 4.7.0 生成“函数调用中缺少标记”警告。我相信这是编译器的错误,因为最终的 NULL值(value)就在那里。 #inclu
我读到,有时 && 运算符用于“短路”JavaScript,使其相信返回值 0 是 0 而不是 NaN,因为 0 在 JavaScript 中是一个虚假数字。我一直在四处寻找,想弄清楚这一切意味着什么
我正在使用 Borland(又名“Embarcodegearland”)C++Builder 2007 编译器,它有一个小错误,系统头文件中的某些 static const 项可能导致虚假的 "xyz
我是一名优秀的程序员,十分优秀!