Open zhongxunchao opened 1 year ago
I am having the same issue -> https://github.com/Baseflow/flutter-permission-handler/issues/956
I've labeled this as an enhancement. Related to https://github.com/Baseflow/flutter-permission-handler/issues/956 and https://github.com/Baseflow/flutter-permission-handler/issues/682
We've had some trials and errors, and finally made it. The key regarding add-to app is you must edit podfile in your existing ios app, not the one in the flutter module. Hope you guys have good luck.
We have done that as well, for us that doesn't work. 🤷
Could you try to edit podfile in the flutter module too? I've checked the code and found we added some source code of permissions in both of podfiles.
I have tried:
None of them worked for us
Same issue. I use Flutter Module Project to build iOS Frameworks, then add these frameworks to my Native iOS Example App, everything works fine except permission. When I call PermissionStatus status = await Permission.microphone.request();
, I get a PermissionStatus.permanentlyDenied
.
I find @jinsubkim-newin 's answer, and it works!
Find ".ios" folder(a hidden folder) in Flutter Module Project's folder. Open "Podfile" inside ".ios" and edit like this:
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
# flutter permission_handler required.
target.build_configurations.each do |config|
# Xcode 14.3 remove arc folder, need update deployment_target version.
# ref: https://blog.csdn.net/crasowas/article/details/129901398.
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: PermissionGroup.microphone
'PERMISSION_MICROPHONE=1',
]
end
end
end
flutter build ios-framework --output=framework/
to build iOS Frameworks.PermissionStatus status = await Permission.microphone.request();
Hope this helps.
Same issue. I use Flutter Module Project to build iOS Frameworks, then add these frameworks to my Native iOS Example App, everything works fine except permission. When I call
PermissionStatus status = await Permission.microphone.request();
, I get aPermissionStatus.permanentlyDenied
.I find @jinsubkim-newin 's answer, and it works!
- Add Privacy - Microphone Usage Description in Native iOS Example App's Info.plist
- Find ".ios" folder(a hidden folder) in Flutter Module Project's folder. Open "Podfile" inside ".ios" and edit like this:
post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) # flutter permission_handler required. target.build_configurations.each do |config| # Xcode 14.3 remove arc folder, need update deployment_target version. # ref: https://blog.csdn.net/crasowas/article/details/129901398. config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0' config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [ '$(inherited)', ## dart: PermissionGroup.microphone 'PERMISSION_MICROPHONE=1', ] end end end
- Flutter Module Project call
flutter build ios-framework --output=framework/
to build iOS Frameworks.- Add these new frameworks to my Native iOS Example App, and works fine. System permission dialogue shows up when I first call
PermissionStatus status = await Permission.microphone.request();
Hope this helps.
Is there any solution for this problem. i tried this also.not working.
💬 Questions and Help
I build iOS framework with command
flutter build ios-framework
, and my business contains Camera Permission Request. After the framework is integrated, the permission request failed. I know I can add config in Podfile:But if the flutter project is built as framework, it won't work, because it won't add the right macro such as PERMISSION_LOCATION=1 to the flutter target. What should I do?