Skip to content

Commit 87a5978

Browse files
committed
Update README
1 parent 20606c7 commit 87a5978

File tree

2 files changed

+69
-39
lines changed

2 files changed

+69
-39
lines changed

README.md

+68-39
Original file line numberDiff line numberDiff line change
@@ -54,58 +54,87 @@ For this plugin to work you will have to add permission configuration to your `A
5454
- [Info.plist](https://github.com/Baseflow/flutter-permission-handler/blob/develop/example/ios/Runner/Info.plist)
5555

5656
> 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).
57-
> 1. Add the following to your "Podfile" file:
57+
58+
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.
59+
60+
By default, all the permissions listed [here](https://github.com/Baseflow/flutter-permission-handler#list-of-available-permissions) are supported.
61+
62+
You can remove permissions you don't use by:
63+
64+
> 1. Add the following to your `Podfile` file:
5865
>
59-
> ```ruby
60-
> post_install do |installer|
61-
> installer.pods_project.targets.each do |target|
62-
> target.build_configurations.each do |config|
63-
> ... # Here are some configurations automatically generated by flutter
64-
>
65-
> # You can remove unused permissions here
66-
> # e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'
67-
> config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
68-
> '$(inherited)',
66+
> ```ruby
67+
> post_install do |installer|
68+
> installer.pods_project.targets.each do |target|
69+
> target.build_configurations.each do |config|
70+
> ... # Here are some configurations automatically generated by flutter
71+
>
72+
> # You can remove unused permissions here
73+
> # for more infomation: https://github.com/BaseflowIT/flutter-permission-handler/blob/develop/ios/Classes/PermissionHandlerEnums.h
74+
> # e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'
75+
> config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
76+
> '$(inherited)',
6977
>
70-
> ## dart: PermissionGroup.calendar
71-
> # 'PERMISSION_EVENTS=0',
78+
> ## dart: PermissionGroup.calendar
79+
> # 'PERMISSION_EVENTS=0',
7280
>
73-
> ## dart: PermissionGroup.reminders
74-
> # 'PERMISSION_REMINDERS=0',
81+
> ## dart: PermissionGroup.reminders
82+
> # 'PERMISSION_REMINDERS=0',
7583
>
76-
> ## dart: PermissionGroup.contacts
77-
> # 'PERMISSION_CONTACTS=0',
84+
> ## dart: PermissionGroup.contacts
85+
> # 'PERMISSION_CONTACTS=0',
7886
>
79-
> ## dart: PermissionGroup.camera
80-
> # 'PERMISSION_CAMERA=0',
87+
> ## dart: PermissionGroup.camera
88+
> # 'PERMISSION_CAMERA=0',
8189
>
82-
> ## dart: PermissionGroup.microphone
83-
> # 'PERMISSION_MICROPHONE=0',
90+
> ## dart: PermissionGroup.microphone
91+
> # 'PERMISSION_MICROPHONE=0',
8492
>
85-
> ## dart: PermissionGroup.speech
86-
> # 'PERMISSION_SPEECH_RECOGNIZER=0',
93+
> ## dart: PermissionGroup.speech
94+
> # 'PERMISSION_SPEECH_RECOGNIZER=0',
8795
>
88-
> ## dart: PermissionGroup.photos
89-
> # 'PERMISSION_PHOTOS=0',
96+
> ## dart: PermissionGroup.photos
97+
> # 'PERMISSION_PHOTOS=0',
9098
>
91-
> ## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
92-
> # 'PERMISSION_LOCATION=0',
99+
> ## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
100+
> # 'PERMISSION_LOCATION=0',
93101
>
94-
> ## dart: PermissionGroup.notification
95-
> # 'PERMISSION_NOTIFICATIONS=0',
102+
> ## dart: PermissionGroup.notification
103+
> # 'PERMISSION_NOTIFICATIONS=0',
96104
>
97-
> ## dart: PermissionGroup.mediaLibrary
98-
> # 'PERMISSION_MEDIA_LIBRARY=0',
105+
> ## dart: PermissionGroup.mediaLibrary
106+
> # 'PERMISSION_MEDIA_LIBRARY=0',
99107
>
100-
> ## dart: PermissionGroup.sensors
101-
> # 'PERMISSION_SENSORS=0'
102-
> ]
108+
> ## dart: PermissionGroup.sensors
109+
> # 'PERMISSION_SENSORS=0'
110+
> ]
103111
>
104-
> end
105-
> end
106-
> end
107-
> ```
108-
> 2. Clean & Rebuild
112+
> end
113+
> end
114+
> end
115+
> ```
116+
>
117+
> 2. Delete the corresponding permission description in `Info.plist`
118+
>
119+
> e.g. when you don't need camera permission, just delete 'NSCameraUsageDescription'
120+
>
121+
> The following lists the relationship between `Permission` and `The key of Info.plist`:
122+
>
123+
> | Permission | Info.plist | Macro |
124+
> |---|---|---|---|
125+
> | PermissionGroup.calendar | NSCalendarsUsageDescription | PERMISSION_EVENTS |
126+
> | PermissionGroup.reminders | NSRemindersUsageDescription | PERMISSION_REMINDERS |
127+
> | PermissionGroup.contacts | NSContactsUsageDescription | PERMISSION_CONTACTS |
128+
> | PermissionGroup.camera | NSCameraUsageDescription | PERMISSION_CAMERA |
129+
> | PermissionGroup.microphone | NSMicrophoneUsageDescription | PERMISSION_MICROPHONE |
130+
> | PermissionGroup.speech | NSSpeechRecognitionUsageDescription | PERMISSION_SPEECH_RECOGNIZER |
131+
> | PermissionGroup.photos | NSPhotoLibraryUsageDescription | PERMISSION_PHOTOS |
132+
> | PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse | NSLocationUsageDescription, NSLocationAlwaysAndWhenInUseUsageDescription, NSLocationWhenInUseUsageDescription | PERMISSION_LOCATION |
133+
> | PermissionGroup.notification | PermissionGroupNotification | PERMISSION_NOTIFICATIONS |
134+
> | PermissionGroup.mediaLibrary | NSAppleMusicUsageDescription, kTCCServiceMediaLibrary | PERMISSION_MEDIA_LIBRARY |
135+
> | PermissionGroup.sensors | NSMotionUsageDescription | PERMISSION_SENSORS |
136+
>
137+
> 3. Clean & Rebuild
109138

110139
## API
111140

example/ios/Podfile

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ post_install do |installer|
6666
config.build_settings['ENABLE_BITCODE'] = 'NO'
6767

6868
# You can remove unused permissions here
69+
# for more infomation: https://github.com/BaseflowIT/flutter-permission-handler/blob/develop/ios/Classes/PermissionHandlerEnums.h
6970
# e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'
7071
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
7172
'$(inherited)',

0 commit comments

Comments
 (0)