iOS 蓝牙技巧

@property (nonatomic, strong) CBCentralManager *centralManager;


取消蓝牙未打开等系统提示框(是否打开蓝牙...)

        NSDictionary *dic = @{CBCentralManagerOptionShowPowerAlertKey:[NSNumber numberWithBool:NO]};        

_centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil options:dic];


手动回调监控蓝牙状态(默认是创建时候调用,蓝牙状态改变时候调用)

 [_centralManager.delegate centralManagerDidUpdateState:_centralManager];


取CBPeer的identifier的标识符

CBPeripheral *backPeripheral;

Str =backPeripheral.identifier.UUIDString;

你可能感兴趣的:(iOS 蓝牙技巧)