繁体   English   中英

如何在IOS中检查蓝牙是打开还是关闭?

[英]How can i check the Bluetooth is ON or OFF in IOS?

我正在使用GameKit.framework在我的应用程序中实现蓝牙,但在didLoad中我想检查蓝牙是打开还是关闭。 谁能告诉我怎么做?

有一个名为BluetoothManager私有框架可以轻松获得状态。 但是,如果您使用它,您的应用可能会被从应用商店中拒绝 因此,只能将此用于您打算以其他方式分发的应用。

在项目中包含此标题 然后你可以写:

#import "BluetoothManager/BluetoothManager.h"

BluetoothManager *bt;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    bt = [[BluetoothManager alloc] init];
}

- (BOOL)getBluetoothEnabled {
    return [bt enabled];
}

然后,您只需调用getBluetoothEnabled

您无法使用当前的SDK进行检查。 没有可用的公共API

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM