即使蓝牙授权了还是出现.denied状态问题
除了配置
<key>NSBluetoothAlwaysUsageDescription</key>
<string>我们需要您的同意来访问蓝牙</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>我们需要您的同意来访问蓝牙</string>
还得在PodFlie文件加上
target.build_configurations.eachdo |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
# dart: [PermissionGroup. location, PermissionGroup. locationAlways, PermissionGroup. locationWhenInUse]
'PERMISSION_LOCATION=1',
## dart: PermissionGroup.bluetooth
'PERMISSION_BLUETOOTH=1',
]
end
蓝牙 var status = await Permission.bluetooth.status;
才不会总是.denied的状态,就会出现.granted的授权状态
网友评论