美文网首页
ios蓝牙 未测试

ios蓝牙 未测试

作者: j了个p | 来源:发表于2016-01-07 10:36 被阅读0次

    - (void)viewDidLoad {

    [superviewDidLoad];

    self.MyCertralManager=[[CBCentralManageralloc]initWithDelegate:selfqueue:nil];

    // Do any additional setup after loading the view, typically from a nib.

    }

    -(void)centralManagerDidUpdateState:(CBCentralManager*)central{

    switch(central.state) {

    caseCBCentralManagerStateUnknown:

    break;

    caseCBCentralManagerStateUnsupported:

    NSLog(@"1");

    break;

    caseCBCentralManagerStateUnauthorized:

    break;

    caseCBCentralManagerStatePoweredOff:

    NSLog(@"2");

    break;

    caseCBCentralManagerStateResetting:

    break;

    caseCBCentralManagerStatePoweredOn:

    NSLog(@"3");

    [self.MyCertralManagerscanForPeripheralsWithServices:niloptions:nil];

    [self.myActivityIndicatorstartAnimating];

    break;

    default:

    break;

    }

    }

    -(void)centralManager:(CBCentralManager*)central didDiscoverPeripheral:(CBPeripheral*)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber*)RSSI{

    [self.myActivityIndicatorstopAnimating];

    NSLog(@"the name%@",peripheral.name);

    }

    相关文章

      网友评论

          本文标题:ios蓝牙 未测试

          本文链接:https://www.haomeiwen.com/subject/fdjfkttx.html