Commit 87a59786 by ty0x2333

Update README

parent 20606c77
...@@ -54,58 +54,87 @@ For this plugin to work you will have to add permission configuration to your `A ...@@ -54,58 +54,87 @@ For this plugin to work you will have to add permission configuration to your `A
- [Info.plist](https://github.com/Baseflow/flutter-permission-handler/blob/develop/example/ios/Runner/Info.plist) - [Info.plist](https://github.com/Baseflow/flutter-permission-handler/blob/develop/example/ios/Runner/Info.plist)
> IMPORTANT: ~~On iOS you will have to include all permission options when you want to submit your App.~~ This is because the `permission_handler` plugin touches all different SDKs and because the static code analyser (run by Apple upon App submission) detects this and will assert if it cannot find a matching permission option in the `Info.plist`. More information about this can be found [here](https://github.com/BaseflowIT/flutter-permission-handler/issues/26). > IMPORTANT: ~~On iOS you will have to include all permission options when you want to submit your App.~~ This is because the `permission_handler` plugin touches all different SDKs and because the static code analyser (run by Apple upon App submission) detects this and will assert if it cannot find a matching permission option in the `Info.plist`. More information about this can be found [here](https://github.com/BaseflowIT/flutter-permission-handler/issues/26).
> 1. Add the following to your "Podfile" file:
On iOS, the permission_handler plugin use [macros](https://github.com/BaseflowIT/flutter-permission-handler/blob/develop/ios/Classes/PermissionHandlerEnums.h) to control whether a permission is supported.
By default, all the permissions listed [here](https://github.com/Baseflow/flutter-permission-handler#list-of-available-permissions) are supported.
You can remove permissions you don't use by:
> 1. Add the following to your `Podfile` file:
> >
> ```ruby > ```ruby
> post_install do |installer| > post_install do |installer|
> installer.pods_project.targets.each do |target| > installer.pods_project.targets.each do |target|
> target.build_configurations.each do |config| > target.build_configurations.each do |config|
> ... # Here are some configurations automatically generated by flutter > ... # Here are some configurations automatically generated by flutter
> >
> # You can remove unused permissions here > # You can remove unused permissions here
> # e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0' > # for more infomation: https://github.com/BaseflowIT/flutter-permission-handler/blob/develop/ios/Classes/PermissionHandlerEnums.h
> config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [ > # e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'
> '$(inherited)', > config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
> '$(inherited)',
> >
> ## dart: PermissionGroup.calendar > ## dart: PermissionGroup.calendar
> # 'PERMISSION_EVENTS=0', > # 'PERMISSION_EVENTS=0',
> >
> ## dart: PermissionGroup.reminders > ## dart: PermissionGroup.reminders
> # 'PERMISSION_REMINDERS=0', > # 'PERMISSION_REMINDERS=0',
> >
> ## dart: PermissionGroup.contacts > ## dart: PermissionGroup.contacts
> # 'PERMISSION_CONTACTS=0', > # 'PERMISSION_CONTACTS=0',
> >
> ## dart: PermissionGroup.camera > ## dart: PermissionGroup.camera
> # 'PERMISSION_CAMERA=0', > # 'PERMISSION_CAMERA=0',
> >
> ## dart: PermissionGroup.microphone > ## dart: PermissionGroup.microphone
> # 'PERMISSION_MICROPHONE=0', > # 'PERMISSION_MICROPHONE=0',
> >
> ## dart: PermissionGroup.speech > ## dart: PermissionGroup.speech
> # 'PERMISSION_SPEECH_RECOGNIZER=0', > # 'PERMISSION_SPEECH_RECOGNIZER=0',
> >
> ## dart: PermissionGroup.photos > ## dart: PermissionGroup.photos
> # 'PERMISSION_PHOTOS=0', > # 'PERMISSION_PHOTOS=0',
> >
> ## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse] > ## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
> # 'PERMISSION_LOCATION=0', > # 'PERMISSION_LOCATION=0',
> >
> ## dart: PermissionGroup.notification > ## dart: PermissionGroup.notification
> # 'PERMISSION_NOTIFICATIONS=0', > # 'PERMISSION_NOTIFICATIONS=0',
> >
> ## dart: PermissionGroup.mediaLibrary > ## dart: PermissionGroup.mediaLibrary
> # 'PERMISSION_MEDIA_LIBRARY=0', > # 'PERMISSION_MEDIA_LIBRARY=0',
> >
> ## dart: PermissionGroup.sensors > ## dart: PermissionGroup.sensors
> # 'PERMISSION_SENSORS=0' > # 'PERMISSION_SENSORS=0'
> ] > ]
> >
> end > end
> end > end
> end > end
> ``` > ```
> 2. Clean & Rebuild >
> 2. Delete the corresponding permission description in `Info.plist`
>
> e.g. when you don't need camera permission, just delete 'NSCameraUsageDescription'
>
> The following lists the relationship between `Permission` and `The key of Info.plist`:
>
> | Permission | Info.plist | Macro |
> |---|---|---|---|
> | PermissionGroup.calendar | NSCalendarsUsageDescription | PERMISSION_EVENTS |
> | PermissionGroup.reminders | NSRemindersUsageDescription | PERMISSION_REMINDERS |
> | PermissionGroup.contacts | NSContactsUsageDescription | PERMISSION_CONTACTS |
> | PermissionGroup.camera | NSCameraUsageDescription | PERMISSION_CAMERA |
> | PermissionGroup.microphone | NSMicrophoneUsageDescription | PERMISSION_MICROPHONE |
> | PermissionGroup.speech | NSSpeechRecognitionUsageDescription | PERMISSION_SPEECH_RECOGNIZER |
> | PermissionGroup.photos | NSPhotoLibraryUsageDescription | PERMISSION_PHOTOS |
> | PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse | NSLocationUsageDescription, NSLocationAlwaysAndWhenInUseUsageDescription, NSLocationWhenInUseUsageDescription | PERMISSION_LOCATION |
> | PermissionGroup.notification | PermissionGroupNotification | PERMISSION_NOTIFICATIONS |
> | PermissionGroup.mediaLibrary | NSAppleMusicUsageDescription, kTCCServiceMediaLibrary | PERMISSION_MEDIA_LIBRARY |
> | PermissionGroup.sensors | NSMotionUsageDescription | PERMISSION_SENSORS |
>
> 3. Clean & Rebuild
## API ## API
......
...@@ -66,6 +66,7 @@ post_install do |installer| ...@@ -66,6 +66,7 @@ post_install do |installer|
config.build_settings['ENABLE_BITCODE'] = 'NO' config.build_settings['ENABLE_BITCODE'] = 'NO'
# You can remove unused permissions here # You can remove unused permissions here
# for more infomation: https://github.com/BaseflowIT/flutter-permission-handler/blob/develop/ios/Classes/PermissionHandlerEnums.h
# e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0' # e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [ config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)', '$(inherited)',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment