Skip to content

Commit 2db062f

Browse files
Updates the README for the new location permissions. (#1297)
* Updates the README for the new location permissions * Update permission_handler/CHANGELOG.md Co-authored-by: TimHoogstrate <tim566@hotmail.com> --------- Co-authored-by: TimHoogstrate <tim566@hotmail.com>
1 parent 74e89c0 commit 2db062f

File tree

3 files changed

+80
-76
lines changed

3 files changed

+80
-76
lines changed

permission_handler/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 11.3.1
2+
3+
* Documents the use of the `PERMISSION_LOCAITON_WHENINUSE` macro on iOS.
4+
15
## 11.3.0
26

37
* Adds a new permission `Permission.backgroundRefresh` to check the background refresh permission status via:

permission_handler/README.md

Lines changed: 74 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the [FAQ](#faq) section for more information on common questions when using
1414
While the permissions are being requested during runtime, you'll still need to tell the OS which permissions your app might potentially use. That requires adding permission configuration to Android* and iOS-specific files.
1515

1616
<details>
17-
<summary>Android</summary>
17+
<summary>Android (click to expand)</summary>
1818

1919
**Upgrade pre-1.12 Android projects**
2020

@@ -52,7 +52,7 @@ In general, it's sufficient to add permission only to the `main` version.
5252
</details>
5353

5454
<details>
55-
<summary>iOS</summary>
55+
<summary>iOS (click to expand)</summary>
5656

5757
Add permission to your `Info.plist` file.
5858
[Here](https://github.com/Baseflow/flutter-permission-handler/blob/master/permission_handler/example/ios/Runner/Info.plist)'s an example `Info.plist` with a complete list of all possible permissions.
@@ -65,78 +65,76 @@ You must list the permission you want to use in your application:
6565

6666
1. Add the following to your `Podfile` file:
6767

68-
```ruby
69-
post_install do |installer|
70-
installer.pods_project.targets.each do |target|
71-
... # Here are some configurations automatically generated by flutter
72-
73-
# Start of the permission_handler configuration
74-
target.build_configurations.each do |config|
75-
76-
# You can enable the permissions needed here. For example to enable camera
77-
# permission, just remove the `#` character in front so it looks like this:
78-
#
79-
# ## dart: PermissionGroup.camera
80-
# 'PERMISSION_CAMERA=1'
81-
#
82-
# Preprocessor definitions can be found at: https://github.com/Baseflow/flutter-permission-handler/blob/master/permission_handler_apple/ios/Classes/PermissionHandlerEnums.h
83-
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
84-
'$(inherited)',
85-
86-
## dart: [PermissionGroup.calendarWriteOnly, PermissionGroup.calendar (iOS 16 and below)]
87-
# 'PERMISSION_EVENTS=1',
88-
89-
## dart: [PermissionGroup.calendarFullAccess, PermissionGroup.calendar (iOS 17 and above)]
90-
# 'PERMISSION_EVENTS_FULL_ACCESS=1',
91-
92-
## dart: PermissionGroup.reminders
93-
# 'PERMISSION_REMINDERS=1',
68+
```ruby
69+
post_install do |installer|
70+
installer.pods_project.targets.each do |target|
71+
flutter_additional_ios_build_settings(target)
9472

95-
## dart: PermissionGroup.contacts
96-
# 'PERMISSION_CONTACTS=1',
73+
target.build_configurations.each do |config|
74+
# You can remove unused permissions here
75+
# for more information: https://github.com/BaseflowIT/flutter-permission-handler/blob/master/permission_handler/ios/Classes/PermissionHandlerEnums.h
76+
# e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'
77+
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
78+
'$(inherited)',
9779

98-
## dart: PermissionGroup.camera
99-
# 'PERMISSION_CAMERA=1',
80+
## dart: PermissionGroup.calendar
81+
'PERMISSION_EVENTS=1',
82+
83+
## dart: PermissionGroup.calendarFullAccess
84+
'PERMISSION_EVENTS_FULL_ACCESS=1',
10085

101-
## dart: PermissionGroup.microphone
102-
# 'PERMISSION_MICROPHONE=1',
86+
## dart: PermissionGroup.reminders
87+
'PERMISSION_REMINDERS=1',
10388

104-
## dart: PermissionGroup.speech
105-
# 'PERMISSION_SPEECH_RECOGNIZER=1',
89+
## dart: PermissionGroup.contacts
90+
'PERMISSION_CONTACTS=1',
10691

107-
## dart: PermissionGroup.photos
108-
# 'PERMISSION_PHOTOS=1',
92+
## dart: PermissionGroup.camera
93+
'PERMISSION_CAMERA=1',
10994

110-
## dart: PermissionGroup.photosAddOnly
111-
# 'PERMISSION_PHOTOS_ADD_ONLY=1',
95+
## dart: PermissionGroup.microphone
96+
'PERMISSION_MICROPHONE=1',
11297

113-
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
114-
# 'PERMISSION_LOCATION=1',
98+
## dart: PermissionGroup.speech
99+
'PERMISSION_SPEECH_RECOGNIZER=1',
115100

116-
## dart: PermissionGroup.notification
117-
# 'PERMISSION_NOTIFICATIONS=1',
101+
## dart: PermissionGroup.photos
102+
'PERMISSION_PHOTOS=1',
118103

119-
## dart: PermissionGroup.mediaLibrary
120-
# 'PERMISSION_MEDIA_LIBRARY=1',
104+
## The 'PERMISSION_LOCATION' macro enables the `locationWhenInUse` and `locationAlways` permission. If
105+
## the application only requires `locationWhenInUse`, only specify the `PERMISSION_LOCATION_WHENINUSE`
106+
## macro.
107+
##
108+
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
109+
'PERMISSION_LOCATION=1',
110+
'PERMISSION_LOCATION_WHENINUSE=0',
121111

122-
## dart: PermissionGroup.sensors
123-
# 'PERMISSION_SENSORS=1',
112+
## dart: PermissionGroup.notification
113+
'PERMISSION_NOTIFICATIONS=1',
124114

125-
## dart: PermissionGroup.bluetooth
126-
# 'PERMISSION_BLUETOOTH=1',
115+
## dart: PermissionGroup.mediaLibrary
116+
'PERMISSION_MEDIA_LIBRARY=1',
127117

128-
## dart: PermissionGroup.appTrackingTransparency
129-
# 'PERMISSION_APP_TRACKING_TRANSPARENCY=1',
118+
## dart: PermissionGroup.sensors
119+
'PERMISSION_SENSORS=1',
130120

131-
## dart: PermissionGroup.criticalAlerts
132-
# 'PERMISSION_CRITICAL_ALERTS=1'
133-
]
121+
## dart: PermissionGroup.bluetooth
122+
'PERMISSION_BLUETOOTH=1',
134123

135-
end
136-
# End of the permission_handler configuration
137-
end
138-
end
139-
```
124+
## dart: PermissionGroup.appTrackingTransparency
125+
'PERMISSION_APP_TRACKING_TRANSPARENCY=1',
126+
127+
## dart: PermissionGroup.criticalAlerts
128+
'PERMISSION_CRITICAL_ALERTS=1',
129+
130+
## dart: PermissionGroup.criticalAlerts
131+
'PERMISSION_ASSISTANT=1',
132+
]
133+
134+
end
135+
end
136+
end
137+
```
140138

141139
2. Remove the `#` character in front of the permission you want to use. For example, if you need access to the calendar make sure the code looks like this:
142140

@@ -149,21 +147,23 @@ You must list the permission you want to use in your application:
149147
e.g. when you don't need camera permission, just delete 'NSCameraUsageDescription'
150148
The following lists the relationship between `Permission` and `The key of Info.plist`:
151149

152-
| Permission | Info.plist | Macro |
153-
|-------------------------------------------------------------------------------------------| ------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
154-
| PermissionGroup.calendar (< iOS 17) | NSCalendarsUsageDescription | PERMISSION_EVENTS |
155-
| PermissionGroup.calendarWriteOnly (iOS 17+) | NSCalendarsWriteOnlyAccessUsageDescription | PERMISSION_EVENTS |
156-
| PermissionGroup.calendarFullAccess (iOS 17+) | NSCalendarsFullAccessUsageDescription | PERMISSION_EVENTS_FULL_ACCESS |
157-
| PermissionGroup.reminders | NSRemindersUsageDescription | PERMISSION_REMINDERS |
158-
| PermissionGroup.contacts | NSContactsUsageDescription | PERMISSION_CONTACTS |
159-
| PermissionGroup.camera | NSCameraUsageDescription | PERMISSION_CAMERA |
160-
| PermissionGroup.microphone | NSMicrophoneUsageDescription | PERMISSION_MICROPHONE |
161-
| PermissionGroup.speech | NSSpeechRecognitionUsageDescription | PERMISSION_SPEECH_RECOGNIZER |
162-
| PermissionGroup.photos | NSPhotoLibraryUsageDescription | PERMISSION_PHOTOS |
163-
| PermissionGroup.photosAddOnly | NSPhotoLibraryAddUsageDescription | PERMISSION_PHOTOS_ADD_ONLY |
150+
| Permission | Info.plist | Macro |
151+
|---------------------------------------------------------------------------------------------| ------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
152+
| PermissionGroup.calendar (< iOS 17) | NSCalendarsUsageDescription | PERMISSION_EVENTS |
153+
| PermissionGroup.calendarWriteOnly (iOS 17+) | NSCalendarsWriteOnlyAccessUsageDescription | PERMISSION_EVENTS |
154+
| PermissionGroup.calendarFullAccess (iOS 17+) | NSCalendarsFullAccessUsageDescription | PERMISSION_EVENTS_FULL_ACCESS |
155+
| PermissionGroup.reminders | NSRemindersUsageDescription | PERMISSION_REMINDERS |
156+
| PermissionGroup.contacts | NSContactsUsageDescription | PERMISSION_CONTACTS |
157+
| PermissionGroup.camera | NSCameraUsageDescription | PERMISSION_CAMERA |
158+
| PermissionGroup.microphone | NSMicrophoneUsageDescription | PERMISSION_MICROPHONE |
159+
| PermissionGroup.speech | NSSpeechRecognitionUsageDescription | PERMISSION_SPEECH_RECOGNIZER |
160+
| PermissionGroup.photos | NSPhotoLibraryUsageDescription | PERMISSION_PHOTOS |
161+
| PermissionGroup.photosAddOnly | NSPhotoLibraryAddUsageDescription | PERMISSION_PHOTOS_ADD_ONLY |
164162
| PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse | NSLocationUsageDescription, NSLocationAlwaysAndWhenInUseUsageDescription, NSLocationWhenInUseUsageDescription | PERMISSION_LOCATION |
165-
| PermissionGroup.notification | PermissionGroupNotification | PERMISSION_NOTIFICATIONS |
166-
| PermissionGroup.mediaLibrary | NSAppleMusicUsageDescription, kTCCServiceMedia
163+
| PermissionGroup.locationWhenInUse | NSLocationWhenInUseUsageDescription | PERMISSION_LOCATION_WHENINUSE |
164+
| PermissionGroup.notification | PermissionGroupNotification | PERMISSION_NOTIFICATIONS |
165+
| PermissionGroup.mediaLibrary | NSAppleMusicUsageDescription, kTCCServiceMedia |
166+
PERMISSION_MEDIA_LIBRARY |
167167

168168
4. Clean & Rebuild
169169

permission_handler/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: permission_handler
22
description: Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.
33
repository: https://github.com/baseflow/flutter-permission-handler
44
issue_tracker: https://github.com/Baseflow/flutter-permission-handler/issues
5-
version: 11.3.0
5+
version: 11.3.1
66

77

88
environment:
@@ -26,7 +26,7 @@ dependencies:
2626
sdk: flutter
2727
meta: ^1.7.0
2828
permission_handler_android: ^12.0.3
29-
permission_handler_apple: ^9.4.0
29+
permission_handler_apple: ^9.4.3
3030
permission_handler_html: ^0.1.1
3131
permission_handler_windows: ^0.2.1
3232
permission_handler_platform_interface: ^4.2.0

0 commit comments

Comments
 (0)