Maan Lad
Maan Lad

Reputation: 1

ReactNative iOS Permission unavailable issue. (Library : 'react-native-permissions', Version:4.1.5 )

Problem

After all the setup and playing with info.plist as per the instruction for iOS, i ran into the problem while requesting permission from the using the following method in useEffect, I get an "unavailable" status for all the permissions i request.

Versions

Xcode: 14.2
react-native: 0.73.6
react-native-permissions: 4.1.5

import { PERMISSIONS, request, check, RESULTS , requestMultiple } from 'react-native-permissions';

const requestPermisssion=()=>{
requestMultiple([PERMISSIONS.IOS.CAMERA,PERMISSIONS.IOS.CONTACTS,PERMISSIONS.IOS.PHOTO_LIBRARY]).then((results)=>{
            console.log("Multiple request result :: ",results)
        })
    }

Output : Multiple request result :: {"ios.permission.CAMERA": "unavailable", "ios.permission.CONTACTS": "unavailable", "ios.permission.PHOTO_LIBRARY": "unavailable"}

--I've tried setting up podfiles as per the instruction and it did generated the Development Pods files for the permission that i've mentioned in setup_permissions([]).

This shows that the Development pods for RNPermission are generated as i run (bundle exec pod install)

Current Podfile:

require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

def node_require(script)
   # Resolve script with node to allow for hoisting
  require Pod::Executable.execute_command('node', ['-p',
     "require.resolve(
       '#{script}',
       {paths: [process.argv[1]]},
     )", __dir__]).strip
end

node_require('react-native-permissions/scripts/setup.rb')

setup_permissions([
    'Camera',
    'Contacts',
    'PhotoLibrary',
    'Microphone',
    'Notifications'
])
................

Steps that i have performed.

--Cleared the DerivedData folder of the xCode.

--Cleaned the buid folder.

--Rebuild the application along side metro bundler running.

--Changed the podfile as per instruction and run : bundle exec pod install
--Rebuild the application again and it worked completly fine .

Issue

--The issue still remains as the permission status are 'unavailable'.

--New error that i encounterd, after successful build when app runs it shows the error message No Permission Handler Detected (i think this error is regarding the "react-native-permissions" library ) despite that error i can still work with app after dismiss that dialog.

Another important/intresting things that might help you to understand the problem

Although the permissions show as "unavailable," using the built-in library functions to request permissions still prompts the user with the desired "Allow" or "Don't Allow" dialog. Interestingly, even after the user grants permission through this dialog, the permission status remains "unavailable." However, functionality like accessing contacts (e.g., using the react-native-contacts library), opening camera and photoLibrary still works despite the "unavailable" status.

Goal

--To get the correct permission status.

--However the end goal is to get the Microphone Permission for recording and i am using this library for recording react-native-audio-recorder-player.

Upvotes: 0

Views: 197

Answers (0)

Related Questions