【问题标题】:Check if bluetooth is on without system popup on iOS 7在 iOS 7 上检查蓝牙是否在没有系统弹出窗口的情况下打开
【发布时间】:2013-10-07 14:45:54
【问题描述】:

在 iOS 6 中it's not possible to check if bluetooth is on without a system popup being shown

CBCentralManager* testBluetooth = [[CBCentralManager alloc] initWithDelegate:nil queue: nil];

但是,当 [[CBCentralManager alloc] init...] 发生时,如果蓝牙关闭,系统会向用户弹出警报。

现在在 iOS 7 中可以实现吗?

【问题讨论】:

    标签: ios bluetooth ios7


    【解决方案1】:

    在 iOS7 中,如果您使用以下选项初始化管理器,则可以禁用启用蓝牙的提示。

    myCentralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil options:@{CBCentralManagerOptionShowPowerAlertKey:[NSNumber numberWithBool:NO]}];
    

    【讨论】:

    • 你可以用@NO代替[ NSNumber numberWithBool:NO ]
    猜你喜欢
    • 2012-09-14
    • 1970-01-01
    • 2020-02-12
    • 2017-03-17
    • 1970-01-01
    • 2018-09-23
    • 1970-01-01
    • 2012-07-17
    • 1970-01-01
    相关资源
    最近更新 更多