flutter-permission-handler
flutter-permission-handler copied to clipboard
[app-to-app] Document how to integrate in iOS add-to-app scenario using Frameworks
🏗 Enhancement Proposal
Better document how to edit the Podfile with an add-to-app using Frameworks Embedding (Option B of integration)
Pitch
Our team chose to build our Flutter Module separately from the main project to speed up build times by using cached Frameworks.
When integrating permission_handler, we wrongly added GCC_PREPROCESSOR_DEFINITIONS flags to the root project instead of in the module package.
This wasn't picked up by the permission handler build, so we had to move it to the Flutter Module Podfile, which shouldn't even be originaly committed
The way we documented it was like this:
Our internal documentation
For the Flutter module to check for permissions, it uses the permission_handler
plugin. As the plugin can handle all types of permissions, Apple may detect as if
the app depends on all types of weird permissions (location, wifi, etc).
To fix this, you need to add the following to the Podfile of the Flutter Module:
post_install do |installer|
installer.pods_project.targets.each do |target|
# Other Flutter commands such as flutter_additional_ios_build_settings(target)
if target.name == 'permission_handler'
target.build_configurations.each do |config|
# Preprocessor definitions can be found in: https://github.com/Baseflow/flutter-permission-handler/blob/master/permission_handler/ios/Classes/PermissionHandlerEnums.h
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: PermissionGroup.camera
'PERMISSION_CAMERA=1'
]
end
end
end
end
❗️ you should add this to the Podfile which builds the Flutter plugins. If you embed Flutter directly on the root project, add it there.
If it is done separately (by building and embedding Frameworks manually), add it to the
Podfileof the Flutter module. This is usually not committed to the repository, but must be included for the module to work properly.
Platforms affected (mark all that apply)
- [x] :iphone: iOS
- [ ] :robot: Android
Hi @danilofuchs,
Thank you for creating this issue and supplying your internal documentation. Personally I have very little experience with add-to-app integration (up to now I was lucky enough to always work in a greenfield situation). This made it difficult for me to document this situation.
I will make sure to add some additional section with your (slightly modified) documentation as I can see this can be very helpful to others as well.
We are implementing an add-to-app module as well. Everything is working, only the permission_handler is not working correctly.
@danilofuchs your documentation is not working for us. This issue is already 1 year old. Did you in the meantime change anything about your setup?
@vanlooverenkoen I'm no longer working on the project, sorry I cannot reproduce it anymore.
@danilofuchs anybody you know that is still on the project, that you can connect me with? I've been working on this for a couple of days
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/1032