React native “反应本机权限”;未检测到权限处理程序";

React native “反应本机权限”;未检测到权限处理程序";,react-native,cocoapods,plist,react-native-ios,react-native-permissions,React Native,Cocoapods,Plist,React Native Ios,React Native Permissions,我正试图请求react本机项目中的用户访问照片库 我遇到一个问题,它声称我没有在我的Podfile中提供权限处理程序 我的pod文件中有这些代码行 permissions_path = '../node_modules/react-native-permissions/ios' pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary" 除此之外,我还将相关信息导入了Info.

我正试图请求react本机项目中的用户访问照片库 我遇到一个问题,它声称我没有在我的Podfile中提供权限处理程序 我的pod文件中有这些代码行

permissions_path = '../node_modules/react-native-permissions/ios'

pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
除此之外,我还将相关信息导入了Info.plist文件

<key>NSPhotoLibraryUsageDescription</key>
<string>For choosing a photo</string>
如果有人注意到我的代码有问题,我将不胜感激。我不是在使用expo,也不想使用它

编辑1:
我最终使用npx react native init重新初始化了项目,并复制了我的源文件,不包括ios文件夹。这似乎有效,可能是我最初的cocoapods设置的一个问题。

在这次更改后,您是否尝试重建应用程序?@DipanshKhandelwal是的,我有!我还使用npm start--reset cache和/或npm start--clear cache清除了缓存。我还根据文档推荐在xcode中重建了项目。在这次更改后,你是否尝试重建应用程序?@DipanshKhandelwal是的,我有!我还使用npm start--reset cache和/或npm start--clear cache清除了缓存。我还根据文档推荐在xcode中重建了该项目
import {Platform} from 'react-native';
import {Permissions} from 'react-native-permissions';
...

const getPermission = async () => {
    if (Platform.OS !== 'web') {
      const {status} = Permissions.check(
      Permissions.IOS.PHOTO_LIBRARY,
      );
    return status;
  }
};
const addProfilePhoto = async () => {
    const {status} = await getPermission();

    alert('Status: ' + status);
};