[英]Cannot relaunch iOS application which works as BLE central manager
我正在开发一个可作为BLE Central的iOS应用程序。 我想重新启动该应用程序,即使它终止后也可以检测到外围设备。
我根据Apple的编程指南“在后台执行长期操作”部分创建了我的中央管理器。 https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/CoreBluetoothBackgroundProcessingForIOSApps/PerformingTasksWhileYourAppIsInTheBackground.html#//apple_ref/doc/uid/TP40013257-CH7-SW1
但是应用程序。 仅在特定条件下重新启动。
在这种情况下,外围设备开始投放广告后,我的应用程序重新启动([应用程序didFinishLaunchWithOption]和[central willRestoreState]被调用)。
在以下情况下,即使外围设备开始投放广告,我的应用也无法重新启动。
我通常会创建并启动我的中央经理。
NSDictionary *options = @{
CBCentralManagerOptionRestoreIdentifierKey : kBlitCentralMgrRestoreIdKey,
CBCentralManagerOptionShowPowerAlertKey : @YES,
};
self.centralMgr = [[[CBCentralManager alloc] initWithDelegate:self queue:nil options:options] autorelease];
如果您有解决问题的想法,请告诉我们。 感谢您的合作。
如果您从应用切换器上滑动该应用以将其杀死,则操作系统将不会重新启动该应用。 依赖于后台应用刷新的应用也是如此。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.