react-native-permissions icon indicating copy to clipboard operation
react-native-permissions copied to clipboard

await request(PERMISSIONS.IOS.PHOTO_LIBRARY); is always unavailable

Open ajen010 opened this issue 2 months ago • 7 comments

Before submitting a new issue

  • [X] I tested using the latest version of the library, as the bug might be already fixed.
  • [X] I tested using a supported version of react native.
  • [X] I checked for possible duplicate issues, with possible answers.

Bug summary

const granted = await request(PERMISSIONS.IOS.PHOTO_LIBRARY); The code never allows granted = 'granted' the only value granted gets is 'unavailable'

Library version

4.1.5

Environment info

info Fetching system and libraries information...
System:
  OS: macOS 14.4.1
  CPU: (10) arm64 Apple M2 Pro
  Memory: 54.69 MB / 16.00 GB
  Shell:
    version: 3.2.57
    path: /bin/bash
Binaries:
  Node:
    version: 18.20.1
    path: ~/.nvm/versions/node/v18.20.1/bin/node
  Yarn: Not Found
  npm:
    version: 10.5.0
    path: ~/.nvm/versions/node/v18.20.1/bin/npm
  Watchman:
    version: 2024.04.01.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /Users/andrewjennings/.rvm/gems/ruby-3.1.4/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.2 AI-232.10300.40.2321.11567975
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 20.0.2.1
    path: /usr/bin/javac
  Ruby:
    version: 3.1.4
    path: /Users/ajen010/.rvm/rubies/ruby-3.1.4/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.6
    wanted: 0.73.6
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Steps to reproduce

npm install --save react-native-permissions

import RNPermissions, { openSettings, PERMISSIONS, request } from 'react-native-permissions'; const checkImagePermission = async () => { const granted = await request(PERMISSIONS.IOS.PHOTO_LIBRARY); console.log("granted ",granted); }

Reproducible sample code

checkImagePermission()

ajen010 avatar Apr 30 '24 10:04 ajen010

I am happy to pay to have this bug fixed.

ajen010 avatar Apr 30 '24 10:04 ajen010

@ajen010 Could you give me access to a repository?

zoontek avatar Apr 30 '24 10:04 zoontek

I'll have to upload the files to a repo, I'm doing everything on my local. Give me a second.

ajen010 avatar Apr 30 '24 10:04 ajen010

i also need this solution

tanishaCodebrew avatar Apr 30 '24 11:04 tanishaCodebrew

Ok I invited you to the private repo @zoontek zoontek

ajen010 avatar Apr 30 '24 11:04 ajen010

The RNPermissions is used in the ImagePicker.js component.

ajen010 avatar Apr 30 '24 11:04 ajen010

@ajen010 I don't have the issue:

https://github.com/zoontek/react-native-permissions/assets/1902323/11a115f4-41b1-4f85-889b-b370d79cc7f6

Are you sure you didn't forget step 3 of iOS setup?

  1. Then execute pod install in your ios directory (📌 Note that it must be re-executed each time you update this config).

zoontek avatar Apr 30 '24 15:04 zoontek

The issue is the simulators don't respond when you do a request. When the code runs on a real mobile device everything works perfectly.

ajen010 avatar May 07 '24 04:05 ajen010

@ajen010 My screen recording is on a simulator.

zoontek avatar May 07 '24 07:05 zoontek