我试图通过编程方式获取iPhone/iPod蓝牙的状态,无论是开启还是关闭.是否可以使用某些Apple API或第三方API.
此代码允许确定当前的蓝牙状态:
CBCentralManager* testBluetooth = [[CBCentralManager alloc] initWithDelegate:nil queue: nil];
switch ([testBluetooth state]) {....}
Run Code Online (Sandbox Code Playgroud)
但是,当[[CBCentralManager alloc] init ...]发生时,如果蓝牙关闭,系统会向用户弹出警报.
有没有办法检查蓝牙状态而不打扰我的用户?