V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
Ocsap
V2EX  ›  iDev

ios 蓝牙状态判断

  •  
  •   Ocsap · 2019-11-29 16:15:46 +08:00 · 9039 次点击
    这是一个创建于 1856 天前的主题,其中的信息可能已经有所发展或是发生改变。

    iOS 蓝牙有三种状态: 一种是蓝色,可连接状态 一种是灰色,不连接状态 一种是斜线,关闭状态

    问题是,后两者都是 CBManagerStatePoweredOff

    有什么方法可以判断区分后两个状态吗?

    MacDown logo MacDown logo

    3 条回复    2020-12-04 13:27:39 +08:00
    fruitscandy
        1
    fruitscandy  
       2019-11-29 20:49:56 +08:00
    白底那个是从控制中心关闭的,非彻底
    灰色那个是从设置里面关闭的,彻底
    Ocsap
        2
    Ocsap  
    OP
       2019-12-03 10:31:05 +08:00
    @fruitscandy 是的,,,怎么用代码判断
    QiuZH
        3
    QiuZH  
       2020-12-04 13:27:39 +08:00
    CBManagerState 里面有应该就有,没有就没办法了吧
    * @constant CBManagerStateUnknown State unknown, update imminent.
    * @constant CBManagerStateResetting The connection with the system service was momentarily lost, update imminent.
    * @constant CBManagerStateUnsupported The platform doesn't support the Bluetooth Low Energy Central/Client role.
    * @constant CBManagerStateUnauthorized The application is not authorized to use the Bluetooth Low Energy role.
    * @constant CBManagerStatePoweredOff Bluetooth is currently powered off.
    * @constant CBManagerStatePoweredOn Bluetooth is currently powered on and available to use.
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2817 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 13:18 · PVG 21:18 · LAX 05:18 · JFK 08:18
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.