0

我一直在研究通过 BLE 接收健康数据的应用程序。它在后台正常工作,并在特定条件下发送通知。不幸的是,当我安装 iOS 8.1 时出现了问题。它不会在后台触发 peripheral:didUpdateValueForCharacteristic。当我将应用程序返回前台时 - 它正确接收数据。

在 Info.plist -> UIBackgroundModes bluetooth-central 中添加。

我的测试表明,在 8.0 中它仍然可以工作。

4

1 回答 1

3

我创建了要在 AppDelegate.sharedInstance 中使用的 bluetoothManager。

BLEManager 的初始化是在 AppDelegate 中进行的init,应该在ApplicationDidFinishLaunchingWithOptions.

移动其初始化后,它开始工作。iOS 行为有时是未知的。当应用程序加载并准备就绪时,更好地初始化您的管理器!

于 2014-12-15T10:27:08.897 回答