Skip to content

expo-permissions #46

Answered by Alchemist85K
leetaehee asked this question in Q&A
Apr 23, 2021 · 3 comments · 4 replies
Discussion options

You must be logged in to vote

안녕하세요 @leetaehee

네, expo 버전이 올라가면서 expo-permissions 가 deprecated 되었습니다.
문서를 확인해보면, MediaLibrary.requestPermissionsAsync() 등 특정 모듈에서 권한 요청을 하라는 설명을 확인할 수 있습니다.
https://docs.expo.io/versions/latest/sdk/permissions/

코드를 다음과 같이 수정하시면 됩니다.

// src/components/Image.js
import * as ImagePicker from 'expo-image-picker';
- import * as Permissions from 'expo-permissions';

  useEffect(() => {
    (async () => {
      try {
-        if (Platform.OS === 'ios') {
+        if (Platform.OS !== 'web') {
-          const { status } = await Permissions.askAsync(
-            Permissions.CAMERA_ROLL
-          );
+          const { status } = await ImagePicker.requestMediaLibraryPermissionsAsync();

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@sangjin42
Comment options

@Alchemist85K
Comment options

Answer selected by Alchemist85K
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@Alchemist85K
Comment options

@leetaehee
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants