菜鸟教程小白 发表于 2022-12-12 08:54:35

ios - 获取 ios 中可用蓝牙设备的列表


                                            <p><p>有没有办法在 ios 中获取可用蓝牙设备的 mac 地址列表?我正在开发一个程序,该程序使用蓝牙 mac 地址查找附近的人。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>我确定你有:</p>

<pre><code>[centralManager scanForPeripheralsWithServices:nil
                                       options:nil];
</code></pre>

<p>这意味着您的应用正在搜索 BLE 外围设备。</p>

<p>每当您的应用发现外围设备调用时:</p>

<pre><code>- (void)centralManager:(CBCentralManager *)central
didDiscoverPeripheral:(CBPeripheral *)peripheral
advertisementData:(NSDictionary *)advertisementData
            RSSI:(NSNumber *)RSSI
</code></pre>

<p>您可以将每个发现的外围设备添加到 <code>CBPeripheral</code></p> 的 <code>NSArray</code></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 获取 ios 中可用蓝牙设备的列表,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/22668689/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/22668689/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 获取 ios 中可用蓝牙设备的列表