메뉴 건너뛰기

자료실

DATA

Setup

 
$ npm install --save react-native-permissions
# --- or --- 
$ yarn add react-native-permissions

iOS

By default no permission handler is installed. Update your Podfile by choosing the ones you want to check or request, then run pod install.

 
target 'YourAwesomeProject' do
 
  # … 
 
  permissions_path = '../node_modules/react-native-permissions/ios'
 
  pod 'Permission-BluetoothPeripheral', :path => "#{permissions_path}/BluetoothPeripheral.podspec"
  pod 'Permission-Calendars', :path => "#{permissions_path}/Calendars.podspec"
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
  pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts.podspec"
  pod 'Permission-FaceID', :path => "#{permissions_path}/FaceID.podspec"
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec"
  pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary.podspec"
  pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone.podspec"
  pod 'Permission-Motion', :path => "#{permissions_path}/Motion.podspec"
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications.podspec"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec"
  pod 'Permission-Reminders', :path => "#{permissions_path}/Reminders.podspec"
  pod 'Permission-Siri', :path => "#{permissions_path}/Siri.podspec"
  pod 'Permission-SpeechRecognition', :path => "#{permissions_path}/SpeechRecognition.podspec"
  pod 'Permission-StoreKit', :path => "#{permissions_path}/StoreKit.podspec"
 
end

Then update your Info.plist with wanted permissions usage descriptions:

 
<?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>
 
  <!-- ???? Keep only the permissions used in your app ???? -->
 
  <key>NSAppleMusicUsageDescription</key>
  <string>YOUR TEXT</string>
  <key>NSBluetoothAlwaysUsageDescription</key>
  <string>YOUR TEXT</string>
  <key>NSBluetoothPeripheralUsageDescription</key>
  <string>YOUR TEXT</string>
  <key>NSCalendarsUsageDescription</key>
  <string>YOUR TEXT</string>
  <key>NSCameraUsageDescription</key>
  <string>YOUR TEXT</string>
  <key>NSContactsUsageDescription</key>
  <string>YOUR TEXT</string>
  <key>NSFaceIDUsageDescription</key>
  <string>YOUR TEXT</string>
  <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
  <string>YOUR TEXT</string>
  <key>NSLocationAlwaysUsageDescription</key>
  <string>YOUR TEXT</string>
  <key>NSLocationWhenInUseUsageDescription</key>
  <string>YOUR TEXT</string>
  <key>NSMicrophoneUsageDescription</key>
  <string>YOUR TEXT</string>
  <key>NSMotionUsageDescription</key>
  <string>YOUR TEXT</string>
  <key>NSPhotoLibraryUsageDescription</key>
  <string>YOUR TEXT</string>
  <key>NSRemindersUsageDescription</key>
  <string>YOUR TEXT</string>
  <key>NSSpeechRecognitionUsageDescription</key>
  <string>YOUR TEXT</string>
  <key>NSSiriUsageDescription</key>
  <string>YOUR TEXT</string>
 
  <!-- … -->
 
</dict>
</plist>

Workaround for use_frameworks! issues

If you use use_frameworks!, add this at the top of your Podfile:

 
use_frameworks!
 
# Convert all permission pods into static libraries 
pre_install do |installer|
  installer.pod_targets.each do |pod|
    if pod.name.eql?('RNPermissions') || pod.name.start_with?('Permission-')
      def pod.build_type;
        # Uncomment one line depending on your CocoaPods version 
        # Pod::BuildType.static_library # >= 1.9 
        # Pod::Target::BuildType.static_library # < 1.9 
      end
    end
  end
end

Android

Add all wanted permissions to your app android/app/src/main/AndroidManifest.xml file:

 
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.myawesomeapp">
 
  <!-- ???? Keep only the permissions used in your app ???? -->
 
  <uses-permission android:name="android.permission.ACCEPT_HANDOVER" />
  <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
  <uses-permission android:name="android.permission.ANSWER_PHONE_CALLS" />
  <uses-permission android:name="android.permission.BODY_SENSORS" />
  <uses-permission android:name="android.permission.CALL_PHONE" />
  <uses-permission android:name="android.permission.CAMERA" />
  <uses-permission android:name="android.permission.GET_ACCOUNTS" />
  <uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
  <uses-permission android:name="android.permission.READ_CALENDAR" />
  <uses-permission android:name="android.permission.READ_CALL_LOG" />
  <uses-permission android:name="android.permission.READ_CONTACTS" />
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.READ_PHONE_NUMBERS" />
  <uses-permission android:name="android.permission.READ_PHONE_STATE" />
  <uses-permission android:name="android.permission.READ_SMS" />
  <uses-permission android:name="android.permission.RECEIVE_MMS" />
  <uses-permission android:name="android.permission.RECEIVE_SMS" />
  <uses-permission android:name="android.permission.RECEIVE_WAP_PUSH" />
  <uses-permission android:name="android.permission.RECORD_AUDIO" />
  <uses-permission android:name="android.permission.SEND_SMS" />
  <uses-permission android:name="android.permission.USE_SIP" />
  <uses-permission android:name="android.permission.WRITE_CALENDAR" />
  <uses-permission android:name="android.permission.WRITE_CALL_LOG" />
  <uses-permission android:name="android.permission.WRITE_CONTACTS" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <uses-permission android:name="com.android.voicemail.permission.ADD_VOICEMAIL" />
 
  <!-- … -->
 
</manifest>
번호 제목 글쓴이 날짜 조회 수
49 리액트 안드로이드 배포 2021 01.13 키스토어 파일을 보관을 생활화 합시다 소프터 2021.01.13 0
48 우분투 라라벨 설치 소프터 2021.01.04 1
47 우분투 18.04 도커(Docker) 설치 방법 소프터 2021.01.04 1
46 aws 대략가격 참고만 하세요 소프터 2020.12.28 6
45 [php] 비메오사용 정리 1 세팅 소프터 2020.12.22 0
44 [php ]두날짜 사이에 기간을 배열로 반환 하는 함수 소프터 2020.12.11 3
43 개인정보 보안관리 솔루션 가이드 소프터 2020.12.09 1
42 셀레리움을 이용한 로그인과 데이터 크롤링예제 윈도우 10 소프터 2020.12.07 5
41 파이어베이스 웹푸시 소프터 2020.11.28 26
40 리액트 웹뷰 멀티 팝업설정 소프터 2020.10.16 23
39 리액트 네이티브 스플레쉬 정리 소프터 2020.08.27 9
38 chrome 80 SameSite cookie CORS 보안 변경사항 php 대응 소프터 2020.07.22 247
37 phpMyAdmin 접속이 localhost 가 아닐경우 설정법. 소프터 2020.07.16 9
36 [디장고] ubuntu 18.04 웹서버에 올리는법 소프터 2020.07.02 62
35 [장고] mysql 연결하기 우분투 18.04 소프터 2020.07.02 1
34 우분투에서 타임존 변경 소프터 2020.06.18 1
» react-native-permissions NSBluetoothAlwaysUsageDescription 권한을 요청할떄 소프터 2020.06.10 10
32 리액트 블루투스 모듈 ios 에서 pod spec 소프터 2020.06.10 1
31 xcode 캐시 지우는법 소프터 2020.06.10 2
30 [REACT NATIVE] 패키지명, 번들명 변경하기 PACKAGE, BUNDLE [ANDROID, IOS] [1] 소프터 2020.05.29 476