• iOS 10.0以后蓝牙'CBCentralManagerStateUnknown' is deprecated: first deprecated in iOS 10.0


    -(void)centralManagerDidUpdateState:(CBCentralManager *)central
    {
    //    NSLog(@"状态改变了 %ld",(long)central.state);
    //    NSLog(@"状态改变了666:%@",central);
        [self startScan];
        switch (central.state) {
            case CBCentralManagerStateUnknown:CBCentralManagerStateUnknown' is deprecated: first deprecated in iOS 10.0 - Use CBManagerState instead
                NSLog(@"CBCentralManagerStateUnknown---》未知");
                break;
            case CBManagerStateResetting:
                NSLog(@"CBCentralManagerStateResetting---》正在重置");
                break;
            case CBManagerStateUnsupported:
                NSLog(@"CBCentralManagerStateUnsupported---》不支持");
                break;
            case CBManagerStateUnauthorized:
                NSLog(@"CBCentralManagerStateUnauthorized---》设备未授权");
                break;
            case CBManagerStatePoweredOff:
                NSLog(@"CBCentralManagerStatePoweredOff---》关闭");
                //发送消息
                [[NSNotificationCenter defaultCenter]postNotificationName:@"CBManagerStatePoweredOff" object:nil userInfo:@{@"CBManagerStatePoweredOff":@"off"}];
                break;
            case CBManagerStatePoweredOn:
                NSLog(@"CBManagerStatePoweredOn---》打开");
                // 这里已确认蓝牙已打开才开始扫描周围的外设。第一个参数nil就是扫描周围所有的外设。
                [central scanForPeripheralsWithServices:nil options:nil];
                break;
            default:
                break;
        }
    }

    出现这个警告,是说iOS10.0以后蓝牙的这几个方法名字换了一下而已,简单讲就是

    CBCentralManagerStateUnknown变成CBManagerStateUnknown,就是把中间Central去调而已,外国人觉得看起来精简了。
  • 相关阅读:
    MR案例:内连接代码实现
    分布式缓存DistributedCache
    MR案例:Map-Join
    hadoop随手笔记
    Job流程:决定map个数的因素
    Job流程:提交MR-Job过程
    MR案例:Reduce-Join
    MR案例:倒排索引
    MR案例:路径过滤PathFilter
    MR案例:分区和排序
  • 原文地址:https://www.cnblogs.com/gaozhang12345/p/8004041.html
Copyright © 2020-2023  润新知