简体   繁体   English

iOS 8.1中的BLE后台模式

[英]BLE background mode in iOS 8.1

I've been working on application that receives health data trough BLE. 我一直在研究通过BLE接收健康数据的应用程序。 It's been working correctly in background and sending the notification when in specific conditions. 它一直在后台正常运行,并在特定条件下发送通知。 Problems, unfortunately, occured when I installed the iOS 8.1. 不幸的是,当我安装iOS 8.1时出现了问题。 It doesn't trigger peripheral:didUpdateValueForCharacteristic while in background. 在后台时,它不会触发外围设备:didUpdateValueForCharacteristic。 When I go with the app back to foreground - it receives data correctly. 当我使用该应用程序回到前台时,它可以正确接收数据。

In Info.plist -> UIBackgroundModes bluetooth-central is added. 在Info.plist-> UIBackgroundModes中添加了bluetooth-central。

My tests shown, that in 8.0 it was still working. 我的测试表明,在8.0中它仍然可以正常工作。

I've created my bluetoothManager to be used within the AppDelegate.sharedInstance. 我创建了我的bluetoothManager以在AppDelegate.sharedInstance中使用。

Initialisation of BLEManager was made in AppDelegate in init and should be done in ApplicationDidFinishLaunchingWithOptions . BLEManager的初始化是在AppDelegate中取得了init ,应该在做ApplicationDidFinishLaunchingWithOptions

After moving its initialization it started working. 移动其初始化后,它开始工作。 iOS behaviour is sometimes unknown. iOS行为有时未知。 Better init your managers when app is loaded and ready to go! 加载应用程序并准备就绪时,可以更好地初始化您的经理!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM