菜鸟教程小白 发表于 2022-12-12 17:00:40

ios - 低功耗蓝牙应用无法在 iOS 7 上写入特征


                                            <p><p>我有一个低功耗蓝牙 (BLE) 应用,它通过开放式连接与 BLE 设备进行通信。我正在使用 CoreBluetooth 库。在我将我的 iPhone 升级到 iOS 7 并将 XCode 升级到 XCode 5 之后。我重新编译了我的蓝牙低功耗应用程序,发现它不再工作了。连接成功。发现服务和特征没有问题。甚至特征的读取似乎也很好。但是写入应该在 BLE 设备上触发某些操作的特性没有任何效果。</p>

<p>如果我使用 XCode 将相同的应用程序下载到另一部装有 <strong>iOS 6</strong> 的 iPhone,一切正常。所以我可以确定问题可能出在 iOS 7 上,而不是 XCode 5 的重新编译。即使来自同一个项目,XCode 5 也可能为 iOS 6 设备准备不同的应用程序,因为我可以看到应用程序在两台设备上的外观不同。</p>

<p>那么从 iOS 6 到 iOS 7 的哪些变化导致写入特征失败?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>我遇到了同样的问题,问题出在固件而不是您的 iOS 代码上。 iOS6对特征类型比较宽松,而iOS7比较严格。 </p>

<p>必须明确设置 Characteristic 的 WriteWithoutResponse 标志才能与 iOS7 一起使用</p>

<p>我在创业时使用了 RedBear 的 Biscuit for Arduino 来测试我们的产品,该产品在 iOS6 上运行良好,但是当应用程序迁移到 iOS7 时,写入会悄悄地失败。 </p>

<p>更详细的讨论在这里(见来自 Mattj949 的更新)@ <a href="https://redbearlab.zendesk.com/entries/25031402-BLE-Mini-and-iOS-7" rel="noreferrer noopener nofollow">https://redbearlab.zendesk.com/entries/25031402-BLE-Mini-and-iOS-7</a>
关于这个问题有一些 Apple 主题,<a href="http://lists.apple.com/archives/bluetooth-dev/2013/Aug/msg00046.html" rel="noreferrer noopener nofollow">http://lists.apple.com/archives/bluetooth-dev/2013/Aug/msg00046.html</a>和 <a href="http://lists.apple.com/archives/bluetooth-dev/2013/Aug/msg00050.html" rel="noreferrer noopener nofollow">http://lists.apple.com/archives/bluetooth-dev/2013/Aug/msg00050.html</a> </p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 低功耗蓝牙应用无法在 iOS 7 上写入特征,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/20379407/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/20379407/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 低功耗蓝牙应用无法在 iOS 7 上写入特征