我的应用程序使用CoreBluetooth连接BLE设备,还在info.plist中添加了UIBackgroundModes(值“bluetooth-central”)。当应用程序进入后台时,应用程序可以继续从连接的设备读取RSSI值。但几分钟后每次都会在后台杀死app。我使用仪器工具测试实时字节,总字节数约为12MB。在iphone4s,iphone5,iphone5s中测试应用程序,还有这样的问题。所以我不知道如何解决它?我的应用程序需要在后台运行很长时间。每个人都有其他想法吗?
答案 0 :(得分:0)
我认为你应该开始后台任务。
UIApplication *app = [UIApplication sharedApplication];
UIBackgroundTaskIdentifier taskIdentifier = [app beginBackgroundTaskWithExpirationHandler:^{
// Cleanup before closing app
}];