앱을 만들다 보면 권한은 한 번 추가해놓고 다시 건들 일이 없기 때문에 다음에 추가할 때쯤 되면 까먹은 상태인 경우가 많다.
미래의 나를 위해 정리 고고.
사용하는 패키지는 permission_handler
줌 같은 기능의 비디오 채팅 기능을 지원하는 웹뷰를 띄우기 위해서 카메라와 마이크의 권한을 얻어보자.
post_install do |installer|
installer.pods_project.targets.each do |target|
... # Here are some configurations automatically generated by flutter
# Start of the permission_handler configuration
target.build_configurations.each do |config|
# You can enable the permissions needed here. For example to enable camera
# permission, just remove the `#` character in front so it looks like this:
#
# ## dart: PermissionGroup.camera
# 'PERMISSION_CAMERA=1'
#
# Preprocessor definitions can be found in: https://github.com/Baseflow/flutter-permission-handler/blob/master/permission_handler_apple/ios/Classes/PermissionHandlerEnums.h
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: PermissionGroup.calendar
# 'PERMISSION_EVENTS=1',
## dart: PermissionGroup.camera
'PERMISSION_CAMERA=1',
## dart: PermissionGroup.microphone
'PERMISSION_MICROPHONE=1',
]
end
# End of the permission_handler configuration
end
end
2.Info.plist에 권한설명을 추가한다.

flutter clean && flutter pub get
cd ios
pod install
cd..
flutter run
_checkCameraPermission() async {
var status = await Permission.camera.status;
if (status.isDenied) {
// We didn't ask for permission yet or the permission has been denied before but not permanently.
Permission.camera.request();
}
}
_checkMicrophoneermission() async {
var status = await Permission.microphone.status;
if (status.isDenied) {
// We didn't ask for permission yet or the permission has been denied before but not permanently.
Permission.microphone.request();
}
}