Ключ NSPhotoLibraryUsageDescription должен присутствовать в Info.plist для использования камеры ролл



недавно я начал получать эту ошибку:




ключ NSPhotoLibraryUsageDescription должен присутствовать в Info.plist to
используйте камеру ролл.




Я использую React Native для создания своего приложения (я не знаком с собственной разработкой ios), и я не знаю, как добавить этот ключ к информации.файл plist



можете ли вы опубликовать пример? Спасибо



Я использую пакет npm "react-native-camera-roll-picker": "^1.1.7"



enter image description here

877   6  

6 ответов:

спасибо @rmaddy, я добавил Это сразу после других пар клавиш-строк в Info.plist и исправлена проблема:

<key>NSPhotoLibraryUsageDescription</key>
<string>Photo Library Access Warning</string>

Edit:

у меня также возникли аналогичные проблемы на разных компонентах моего приложения. В конечном итоге добавление всех этих ключей до сих пор (после обновления до Xcode8/iOS10):

<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library.</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app does not require access to the microphone.</string>
<key>NSCameraUsageDescription</key>
<string>This app requires access to the camera.</string>

проверьте это developer.apple.com ссылка для полный список из списка свойств ключа ссылки на литературу.

Полный Список:

Apple Music:

<key>NSAppleMusicUsageDescription</key>
<string>My description about why I need this capability</string>

Bluetooth:

<key>NSBluetoothPeripheralUsageDescription</key>  
<string>My description about why I need this capability</string>

календарь:

<key>NSCalendarsUsageDescription</key>
<string>My description about why I need this capability</string>

камера:

<key>NSCameraUsageDescription</key>
<string>My description about why I need this capability</string>

контакты:

<key>NSContactsUsageDescription</key>
<string>My description about why I need this capability</string>

FaceID:

<key>NSFaceIDUsageDescription</key>
<string>My description about why I need this capability</string>

Здоровье Поделиться:

<key>NSHealthShareUsageDescription</key>
<string>My description about why I need this capability</string>

Обновление Здоровья:

<key>NSHealthUpdateUsageDescription</key>
<string>My description about why I need this capability</string>

Home Kit:

<key>NSHomeKitUsageDescription</key>
<string>My description about why I need this capability</string>

Location:

<key>NSLocationUsageDescription</key>
<string>My description about why I need this capability</string>

расположение (Всегда):

<key>NSLocationAlwaysUsageDescription</key>
<string>My description about why I need this capability</string>

расположение (при использовании):

<key>NSLocationWhenInUseUsageDescription</key>
<string>My description about why I need this capability</string>

микрофон:

<key>NSMicrophoneUsageDescription</key>
<string>My description about why I need this capability</string>

Движения (Акселерометр):

<key>NSMotionUsageDescription</key>
<string>My description about why I need this capability</string>

NFC (Near-field communication):

<key>NFCReaderUsageDescription</key>
<string>My description about why I need this capability</string>

Медиатека:

<key>NSPhotoLibraryUsageDescription</key>
<string>My description about why I need this capability</string>

библиотека фотографий (доступ только для записи):

<key>NSPhotoLibraryAddUsageDescription</key>
<string>My description about why I need this capability</string>

замечания:

<key>NSRemindersUsageDescription</key>
<string>My description about why I need this capability</string>

Siri:

<key>NSSiriUsageDescription</key>
<string>My description about why I need this capability</string>

Распознавание Речи:

<key>NSSpeechRecognitionUsageDescription</key>
<string>My description about why I need this capability</string>

МОЙ ЛЮБИМЫЙ СПОСОБ СДЕЛАТЬ ЭТО

1. Открой info.plist

enter image description here

2. Нажмите эту кнопку, чтобы добавить новый ключ

enter image description here

3. Прокрутите вниз, чтобы найтиКонфиденциальность-Описание Использования Библиотеки Фотографий

enter image description here

4. Выберите его, а затем добавьте свое описание правильно

enter image description here

добавить следующий код в info.plist file

<key>NSPhotoLibraryUsageDescription</key>
<string>My description about why I need this capability</string>

enter image description here

для доступа к камере используйте:

<key>NSCameraUsageDescription</key>
<string>Camera Access Warning</string>

вам нужно вставить эти два в вашей информации.плист, это единственный способ, которым он работал для меня для ios11

<key>NSPhotoLibraryUsageDescription</key>
    <string>This app requires access to the photo library.</string>

    <key>NSPhotoLibraryAddUsageDescription</key>
    <string>This app requires access to the photo library.</string>

https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html

"Privacy - Photo Library Additions Usage Description" for iOS 11 and later

"Privacy - Photo Library Usage Description" for iOS 6.0 and later

открыть файл plist и этот код

<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library.</string>

<key>NSPhotoLibraryAddUsageDescription</key>
<string>This app requires access to the photo library.</string>

Comments

    Ничего не найдено.