Arp*_*pit 2 bluetooth ios core-bluetooth
我在我的应用程序中使用iBeacon技术.我正在检查应用程序是否已启用蓝牙或由用户禁用,并且我已在下面编写代码.
- (void)viewDidLoad
{
[super viewDidLoad];
_bluetoothManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil options:nil];
}
// bluetooth manager state change
- (void)centralManagerDidUpdateState:(CBCentralManager *)central
{
NSString *stateString = nil;
switch(central.state)
{
case CBCentralManagerStateResetting: stateString = @"The connection with the system service was momentarily lost, update imminent."; break;
case CBCentralManagerStateUnsupported: stateString = @"The platform doesn't support Bluetooth Low Energy."; break;
case CBCentralManagerStateUnauthorized: stateString = @"The app is not authorized to use Bluetooth Low Energy."; break;
case CBCentralManagerStatePoweredOff: stateString = @"Bluetooth is currently powered off."; break;
case CBCentralManagerStatePoweredOn: stateString = @"Bluetooth is currently powered on and available to use."; break;
default: stateString = @"State unknown, update imminent."; break;
}
}
Run Code Online (Sandbox Code Playgroud)
问题:上面的警告消息经常在后台提示,或者当其他应用程序打开时,即使我已经杀死了应用程序.我想显示此默认警报消息,但仅在用户打开应用程序时显示.
谁能为我提供解决方案?
小智 6
self.bluetoothManager = [[CBCentralManager alloc] initWithDelegate:self
queue:nil
options:@{CBCentralManagerOptionShowPowerAlertKey: @NO}];
Run Code Online (Sandbox Code Playgroud)
这可能会隐藏系统弹出.
| 归档时间: |
|
| 查看次数: |
8036 次 |
| 最近记录: |