You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue #1403 - On iOS, bypass 'always' permission by default (#1404)
* Issue #1403 - On iOS, add conditional compile of the request for 'always' permission, to prevent users getting rejected by Apple for not including NSLocationAlwaysAndWhenInUseUsageDescription even if they never require background location updates.
The compile is conditional on the flag PERMISSION_LOCATION_ALWAYS being set in XCode under 'Preprocessor Macros'. If not set (the default) then the permission request for 'always' is not included in the binary, therefore not triggering a complaint by Apple.
The request for 'always' (background) location updates is rare, so it is reasonable to have this turned off by default, and require some effort by the developer to activate this.
* Changed PERMISSION_LOCATION_ALWAYS to BYPASS_PERMISSION_LOCATION_ALWAYS such that the default behavior (no flag set) remains the same, and the change is non-breaking.
Updated pubspec.yaml, README.md and CHANGELOG.md
* Refinements to permission bypass for background location.
Updates to CHANGELOG.md for geolocator and geolocator_apple
Added code to Podfile for the examples in geolocator and geolocator_apple that - if uncommented - will bypass the permission request by automatically setting the bypass flag upon compilation.
Updated README.md per suggestion
Copy file name to clipboardExpand all lines: geolocator/CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,7 @@
1
+
## 10.1.1
2
+
3
+
- Adds a description to the README on how to add the `BYPASS_PERMISSION_LOCATION_ALWAYS` preprocessor to bypass the need for adding the `NSLocationAlwaysUsageDescription` to the `Info.plist`.
4
+
1
5
## 10.1.0
2
6
3
7
- Includes `altitudeAccuracy` and `headingAccuracy` in `Position`.
Copy file name to clipboardExpand all lines: geolocator/README.md
+20-4Lines changed: 20 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,16 +76,32 @@ Starting from Android 10 you need to add the `ACCESS_BACKGROUND_LOCATION` permis
76
76
<details>
77
77
<summary>iOS</summary>
78
78
79
-
On iOS you'll need to add the following entries to your Info.plist file (located under ios/Runner) in order to access the device's location. Simply open your Info.plist file and add the following (make sure you update the description so it is meaningfull in the context of your App):
79
+
On iOS you'll need to add the following entry to your Info.plist file (located under ios/Runner) in order to access the device's location. Simply open your Info.plist file and add the following (make sure you update the description so it is meaningfull in the context of your App):
80
80
81
81
```xml
82
82
<key>NSLocationWhenInUseUsageDescription</key>
83
83
<string>This app needs access to location when open.</string>
84
-
<key>NSLocationAlwaysUsageDescription</key>
85
-
<string>This app needs access to location when in the background.</string>
86
84
```
87
85
88
-
If you would like to receive updates when your App is in the background, you'll also need to add the Background Modes capability to your XCode project (Project > Signing and Capabilities > "+ Capability" button) and select Location Updates. Be careful with this, you will need to explain in detail to Apple why your App needs this when submitting your App to the AppStore. If Apple isn't satisfied with the explanation your App will be rejected.
86
+
If you don't need to receive updates when your app is in the background, then add a compiler flag as follows: in XCode, click on Pods, choose the Target 'geolocator_apple', choose Build Settings, in the search box look for 'Preprocessor Macros' then add the `BYPASS_PERMISSION_LOCATION_ALWAYS=1` flag.
87
+
Setting this flag prevents your app from requiring the `NSLocationAlwaysAndWhenInUseUsageDescription` entry in Info.plist, and avoids questions from Apple when submitting your app.
88
+
89
+
You can also have this flag be set automatically by adding to the `Podfile` for your application:
If you do want to receive updates when your App is in the background (or if you don't bypass the permission request as described above) then you'll need to:
103
+
* Add the Background Modes capability to your XCode project (Project > Signing and Capabilities > "+ Capability" button) and select Location Updates. Be careful with this, you will need to explain in detail to Apple why your App needs this when submitting your App to the AppStore. If Apple isn't satisfied with the explanation your App will be rejected.
104
+
* Add an `NSLocationAlwaysAndWhenInUseUsageDescription` entry to your Info.plist (use `NSLocationAlwaysUsageDescription` if you're targeting iOS <11.0)
89
105
90
106
When using the `requestTemporaryFullAccuracy({purposeKey: "YourPurposeKey"})` method, a dictionary should be added to the Info.plist file.
Copy file name to clipboardExpand all lines: geolocator_apple/CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,7 @@
1
+
## 2.3.6
2
+
3
+
* Adds option to bypass the request for permission to update location in the background (which can attract scrutiny from Apple upon app submission). To bypass, set the preprocessor macro `BYPASS_PERMISSION_LOCATION_ALWAYS` to 1 in XCode
4
+
1
5
## 2.3.5
2
6
3
7
* Previously the plugin filtered out negative values for heading and/or heading accuracy. Now the plugin is returning the heading and/or the heading accuracy even if the they have a negative value (invalid), so that the developer can use it and decide what to do with it.
0 commit comments