zoontek / react-native-permissions

An unified permissions API for React Native on iOS, Android and Windows.
MIT License
4.02k stars 828 forks source link

NSLocationAlwaysUsageDescription is deprecated #806

Closed doyeka closed 12 months ago

doyeka commented 12 months ago

Bug summary

Whenever I request(PERMISSIONS.IOS.LOCATION_ALWAYS), I immediately receive an error saying: "Cannot check or request permission without the required "NSLocationAlwaysUsageDescription" entry in your app "Info.plist" file.

The "NSLocationAlwaysUsageDescription" is deprecated.

The correct permission to use is NSLocationAlwaysAndWhenInUseUsageDescription.

Screenshot 2023-09-13 at 6 19 20 PM

Library version

3.9.1

Environment info

System:
  OS: macOS 13.5.1
  CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
  Memory: 24.90 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 19.2.0
    path: /private/var/folders/h6/rcyjqnt52sd12sz11rv3g2sc0000gn/T/xfs-8233cd0f/node
  Yarn:
    version: 3.6.1
    path: /private/var/folders/h6/rcyjqnt52sd12sz11rv3g2sc0000gn/T/xfs-8233cd0f/yarn
  npm:
    version: 8.19.4
    path: /private/var/folders/h6/rcyjqnt52sd12sz11rv3g2sc0000gn/T/xfs-8233cd0f/npm
  Watchman:
    version: 2023.06.12.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.12.1
    path: /usr/local/opt/ruby/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.0
      - iOS 17.0
      - macOS 14.0
      - tvOS 17.0
      - visionOS 1.0
      - watchOS 10.0
  Android SDK:
    API Levels:
      - "33"
    Build Tools:
      - 30.0.3
      - 33.0.0
    System Images:
      - android-30 | Google APIs Intel x86 Atom
      - android-33 | Google APIs Intel x86_64 Atom
    Android NDK: Not Found
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10671973
  Xcode:
    version: 15.0/15A5229h
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.19
    path: /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home/bin/javac
  Ruby:
    version: 3.2.2
    path: /usr/local/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Steps to reproduce

  1. Check out the example project. git clone https://github.com/zoontek/react-native-permissions.git
  2. Remove the NSLocationAlwaysUsageDescription key from `react-native-permissions/example/ios/RNPermissionsExample/Info.plist
  3. Build the example project. cd react-native-permissions/example && yarn preinstall && yarn postinstall
  4. Once I click 'Check' or 'Request' LOCATION_ALWAYS in the sample app, I receive the error "Cannot check or request permission without the required "NSLocationAlwaysUsageDescription" entry in your app "Info.plist" file

Reproducible sample code

Use this object as the Info.plist for the example project:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleDisplayName</key>
    <string>RNPermissionsExample</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>$(MARKETING_VERSION)</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>$(CURRENT_PROJECT_VERSION)</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>localhost</key>
            <dict>
                <key>NSExceptionAllowsInsecureHTTPLoads</key>
                <true/>
            </dict>
        </dict>
    </dict>
    <key>NSAppleMusicUsageDescription</key>
    <string>Let me use your media library</string>
    <key>NSBluetoothAlwaysUsageDescription</key>
    <string>Let me use bluetooth</string>
    <key>NSBluetoothPeripheralUsageDescription</key>
    <string>Let me use bluetooth</string>
    <key>NSCalendarsUsageDescription</key>
    <string>Let me use your calendars</string>
    <key>NSCameraUsageDescription</key>
    <string>Let me use the camera</string>
    <key>NSContactsUsageDescription</key>
    <string>Let me use your contacts</string>
    <key>NSFaceIDUsageDescription</key>
    <string>Let me use FaceID</string>
    <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    <string>Let me use your location, even in background</string>
    <key>NSLocationTemporaryUsageDescriptionDictionary</key>
    <dict>
        <key>full-accuracy</key>
        <string>Let me use your precise location temporarily</string>
    </dict>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>Let me use your location when the app is opened</string>
    <key>NSMicrophoneUsageDescription</key>
    <string>Let me use the microphone</string>
    <key>NSMotionUsageDescription</key>
    <string>Let me use your motion data</string>
    <key>NSPhotoLibraryAddUsageDescription</key>
    <string>Let me add photos</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>Let me use your photo library</string>
    <key>NSRemindersUsageDescription</key>
    <string>Let me use your reminders</string>
    <key>NSSpeechRecognitionUsageDescription</key>
    <string>Let me use speech recognition</string>
    <key>NSUserTrackingUsageDescription</key>
    <string>Let me use your ad identifier</string>
    <key>UIAppFonts</key>
    <array>
        <string>MaterialCommunityIcons.ttf</string>
    </array>
    <key>UIBackgroundModes</key>
    <array>
        <string>bluetooth-peripheral</string>
        <string>location</string>
    </array>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
    </array>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
    </array>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>
</dict>
</plist>
zoontek commented 12 months ago

Fixed in 3.9.2