我目前正在开发一个项目,其中 arduino 中的 LTE 蓝牙模块向 Iphone 发送消息。我开始阅读 CBCentral 经理的苹果文档的 iphone 应用程序,并编写了这段代码
-(instancetype)init{
self = [super init];
if(self){
self.bluetoothManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil options:nil];
}
return self;
}
-(instancetype)initWithDelegate:(id<BLEDelegate>)delegate{
self = [self init];
self.delegate = delegate;
return self;
}
- (void)centralManagerDidUpdateState:(CBCentralManager *)central
{
NSLog(@"called");
}
当我实例化 CBCentralManager 并设置委托和自我并启动应用程序时,不会调用 centralManagerDidUpdateState 。