Closed AndrewDongminYoo closed 1 year ago
이 에러는 react-native-permissions
라이브러리를 사용할 때, iOS 권한 처리 핸들러가 설정되지 않았을 때 발생합니다.
해결책으로는 package.json
파일에서 reactNativePermissionsIOS
설정에 최소 하나 이상의 핸들러를 추가해주면 됩니다. 예를 들어, 카메라 권한 처리를 추가하려면 아래와 같이 설정해주면 됩니다.
{
"name": "step-counter-example",
"version": "0.0.1",
"private": true,
"dependencies": {
"@dongminyu/react-native-step-counter": "*",
"react-native-permissions": "^13.1.0"
},
"reactNativePermissionsIOS": {
"Motion": {
"title": "Step Counter Permission",
"message": "This app needs access to your motion sensor",
"buttonPositive": "OK",
"buttonNegative": "Cancel"
}
}
}
직접적으로 이 모듈에 필요한 Motion
Pod을 링크하는 방법도 있습니다. 다음의 코드를 ios 폴더의 Podfile
에 입력하고, npx pod-install
을 실행하면 됩니다.
target 'step-counter-example' do
config = use_native_modules!
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-Motion', :path => "#{permissions_path}/Motion"
또 다른 해결책으로는 앱을 삭제하고, Pod
파일들을 재설치한 후, Xcode
의 DerivedData
폴더를 삭제하고 다시 빌드하면 됩니다.
추가로 알게 된 것. 두가지 방법을 모두 사용하면 인터페이스 충돌이 일어나 빌드가 안된다. 별로 알고싶지는 않았다...
Expected Behavior
react-native-permissions
Actual Behavior
Steps to Reproduce the Problem
yarn create react-native-app my-app
yarn add @dongminyu/react-native-step-counter react-native-permissions
react-native link @dongminyu/react-native-step-counter
npx pod-install
npx react-native run-*android/ios*
Specifications