即使藍(lán)牙授權(quán)了還是出現(xiàn).denied狀態(tài)問題?
除了配置
<key>NSBluetoothAlwaysUsageDescription</key>
<string>我們需要您的同意來訪問藍(lán)牙</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>我們需要您的同意來訪問藍(lán)牙</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
藍(lán)牙 var status = await Permission.bluetooth.status;
才不會(huì)總是.denied的狀態(tài)忌怎,就會(huì)出現(xiàn).granted的授權(quán)狀態(tài)