Permissions.request(IOS.LOCATION_ALWAYS) never resolves in iOS 13
Bug
I don't know if this is behavior of iOS 13 or not. Please clarify this.
At first location permission request, everything works ok. But if user manual go to iOS app setting and turn off location for the app (change it to NEVER) then in the next app open, requesting LOCATION_ALWAYS permission never resolves. If I request LOCATION_WHEN_IN_USE, it works.
I'm using latest 2.0.0 of rn-permissions. auto-link.
Environment info
React native info output:
System:
OS: macOS Mojave 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
Memory: 5.93 GB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.16.3 - /usr/local/opt/node@10/bin/node
Yarn: 1.17.3 - ~/.npm-global/bin/yarn
npm: 6.10.3 - ~/.npm-global/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
Android SDK:
API Levels: 23, 24, 25, 26, 27, 28, 29
Build Tools: 27.0.0, 27.0.2, 27.0.3, 28.0.1, 28.0.2, 28.0.3
System Images: android-29 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5791312
Xcode: 11.0/11A420a - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.1 => 0.61.1
npmGlobalPackages:
create-react-native-app: 2.0.2
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
Podfile
# enable only the permissions you want
permissions_path = '../node_modules/react-native-permissions/ios'
# pod 'Permission-BluetoothPeripheral', :path => "#{permissions_path}/BluetoothPeripheral.podspec"
pod 'Permission-Calendars', :path => "#{permissions_path}/Calendars.podspec"
pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts.podspec"
pod 'Permission-FaceID', :path => "#{permissions_path}/FaceID.podspec"
pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec"
pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec"
# pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary.podspec"
pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone.podspec"
pod 'Permission-Motion', :path => "#{permissions_path}/Motion.podspec"
pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications.podspec"
pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec"
# pod 'Permission-Reminders', :path => "#{permissions_path}/Reminders.podspec"
# pod 'Permission-Siri', :path => "#{permissions_path}/Siri.podspec"
# pod 'Permission-SpeechRecognition', :path => "#{permissions_path}/SpeechRecognition.podspec"
# pod 'Permission-StoreKit', :path => "#{permissions_path}/StoreKit.podspec"
Library version: 2.0.0
Steps To Reproduce
- Fresh install app, check LOCATION_WHEN_IN_USE permission, then request LOCATION_ALWAYS permission.
- Accept permission, then go to ios app settings and switch location setting to NEVER.
- Open app again, checking LOCATION_WHEN_IN_USE permission returns BLOCKED, then requesting LOCATION_ALWAYS permission never resolves.
Describe what you expected to happen:
- RNPermissions.request(IOS.LOCATION_ALWAYS) result need to be resolved if user changes the location permission to NEVER in ios app settings.
Reproducible sample code
try {
return await RNPermissions.request(IOS.LOCATION_ALWAYS); // stuck here if location setting is NEVER
} catch (err) {
return RESULTS.DENIED;
}
related issue: https://github.com/react-native-community/react-native-permissions/issues/294
Hi @tanthanh289. It's not really the same issue as #294 where the request just never appeared, but it's definitively a bug, probably due to location permission changes on iOS 13. I will check it fast since I just upgraded my iPhone too.
hey @zoontek,
got the same issue, and maybe a little for informations after some investigations.
request(IOS.LOCATION_ALWAYS) not working in iOS 13 any more. iOS 13 will ask you automatically if you ask to request location in background.
you get always the request for LOCATION_WHEN_IN_USE. If you need that permission IOS.LOCATION_ALWAYS you have to redirect the User to App Permission Settings.
But there is also something wrong. If change to anything else there and i return to the app react-native-permissions will always return »granted« on IOS.LOCATION_ALWAYS even if i set »Never«
It just shipped a version which fixes the location permission behavior on iOS 13: https://github.com/react-native-community/react-native-permissions/releases/tag/2.0.1
Permission escalation is no longer possible to stay consistant with the recent Apple changes.
@christocracy maybe of interest
@mikehardy I'm not using react-native-permissions.