Hello,
After
npm install --save react-native-permissions
I added
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec"
pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec"
to my Podfile.
Then updated info.plist with adding
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>YOUR TEXT</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>YOUR TEXT</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>YOUR TEXT</string>
I want to check location permission for ios with
check(PERMISSIONS.IOS.LOCATION_ALWAYS)
.then((permissionResult) => {
But it always returns unavailable on iOS 12.4 simulator.
I use now 2.0.2 as a version.
RN: 0.60.5
@efecantekin Did you check https://github.com/react-native-community/react-native-permissions/issues/357 ?
@efecantekin Did you check #357 ?
Yes, also I see my location on simulator but check returns unavailable.
If the meaning of adding UIBackgroundModes is like
<key>UIBackgroundModes</key>
to plist, I did it.
Are location services enabled on the simulator (Settings > Privacy)?

Does location update background mode is enable in Xcode?

Are location services enabled on the simulator (Settings > Privacy)?
Does location update background mode is enable in Xcode?

Yes, I see custom location on map.
@efecantekin Seeing your location on the map does not mean that you have the right to use the location when the app is in background.
You need to add location in your UIBackgroundModes: https://github.com/react-native-community/react-native-permissions/blob/master/example/ios/RNPermissionsExample/Info.plist#L74
You need to add
locationin yourUIBackgroundModes: https://github.com/react-native-community/react-native-permissions/blob/master/example/ios/RNPermissionsExample/Info.plist#L74
The point was this.
Thank you,
What if I only want to use significant location tracking feature of iOS in background and do not want to enable this UIBackgroundModes location to track locations in background? I still need the permission from user to "Always allow" but location background mode not enabled?
This used to work fine in the earlier versions of react-native-permissions.
Any Thoughts?
@apoorva-techie Indeed, I will remove the check.
@apoorva-techie Done https://github.com/react-native-community/react-native-permissions/releases/tag/2.0.3
Thank you! Life saver this was!