原文链接我在这,【iOS开发笔记】系统权限的获取和请求 - 简书
TenBluetoothManager.m
#import "TenBluetoothManager.h"
@interface TenBluetoothManager () <CBCentralManagerDelegate>
/**蓝牙管理类*/
@property (nonatomic, strong) CBCentralManager *cbCentralManager;
/**请求蓝牙权限回调*/
@property (nonatomic, copy) void (^bluetoothAuthBlock) (BOOL granted, CBPeripheralManagerAuthorizationStatus status);
@end
static TenBluetoothManager *_bluetoothManager;
@implementation TenBluetoothManager
#pragma mark - 构造
/**构造方法*/
+(instancetype)allocWithZone:(struct _NSZone *)zone {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
if (_bluetoothManager == nil) {
_bluetoothManager = [super allocWithZone:zone];
}
});
return _bluetoothManager;
}
/**单例方法*/
+(instancetype)shareManager {
return [[self alloc] init];
}
#pragma mark -

文章详细介绍了如何在iOS中使用TenBluetoothManager类来请求和管理蓝牙权限,包括CBCentralManager的使用,以及授权状态的回调。通过单例方法提供对蓝牙权限的统一管理。

225

被折叠的 条评论
为什么被折叠?



