본문 바로가기

✏️/Flutter

[flutter][ios] App Store Connect reject 해결 (permission handler issue, ios config 하는 법)

728x90

flutter 프로젝트를 하면서 permission을 간단하게 다루기 위해 permission handler를 많이 사용할 것이다.
이 플러그인을 사용 하면서 ios 앱 업로드 시 발생 했던 오류에 대해서 설명하고, 어떻게 해결 하였는지 남겨보겠다.

permission handler는 사용자에게 권한을 요청 해야 하는 것들을 각각 AOS/IOS 환경에서 간편하게 권한 확인을 요청하고, 상태를 확인 할 수 있도록 하는 플러그인이다.

AOS의 경우, 간단하게 설정할 수 있지만
iOS의 경우 좀 까다롭게(^^;;) 설정 해줘야하기 때문에 iOS를 중심으로 다뤄보겠다.

만약, 제대로 설정해주지 않고 app store에 업로드 시도 하면 다음과 같은 메일을 받아보았을 것이다 (..)

이러한 메일이 온 이유는... permission handler 설치 시 기본 권한을 모두 요청하고 있기 때문이다.
따러서 이 문제를 해결하기 위해 천천히 잘 확인하고 설정해주면 된다!

1. ~/ios/Podfile 확인

- 프로젝트에서 필요한 사용자 권한을 확인하고, 필요 없는 것들은 모두 주석 해제!
- 주석 처리 유무를 확인하기 위해 프로젝트에서 사용하고 있는 플러그인 확인 하고, info.plist에서 사용자 권한을 얻는 부분을 비교하면서 작업하면 된다.
- 나의 경우, 파베를 이용해서 알림과 갤러리 접근을 통해 프로필 사진을 바꾸는 기능이 있었기 때문에 
'PERMISSION_NOTIFICATIONS=0',
'PERMISSION_PHOTOS=0' 을 주석처리 해제 처리 해주었다.

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      ... # Here are some configurations automatically generated by flutter

      # You can remove unused permissions here
      # for more infomation: https://github.com/BaseflowIT/flutter-permission-handler/blob/develop/permission_handler/ios/Classes/PermissionHandlerEnums.h
      # e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
        '$(inherited)',

        ## dart: PermissionGroup.calendar
        # 'PERMISSION_EVENTS=0',

        ## dart: PermissionGroup.reminders
        # 'PERMISSION_REMINDERS=0',

        ## dart: PermissionGroup.contacts
        # 'PERMISSION_CONTACTS=0',

        ## dart: PermissionGroup.camera
        # 'PERMISSION_CAMERA=0',

        ## dart: PermissionGroup.microphone
        # 'PERMISSION_MICROPHONE=0',

        ## dart: PermissionGroup.speech
        # 'PERMISSION_SPEECH_RECOGNIZER=0',

        ## dart: PermissionGroup.photos
        # 'PERMISSION_PHOTOS=0',

        ## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
        # 'PERMISSION_LOCATION=0',

        ## dart: PermissionGroup.notification
        # 'PERMISSION_NOTIFICATIONS=0',

        ## dart: PermissionGroup.mediaLibrary
        # 'PERMISSION_MEDIA_LIBRARY=0',

        ## dart: PermissionGroup.sensors
        # 'PERMISSION_SENSORS=0',   

        ## dart: PermissionGroup.bluetooth
        # 'PERMISSION_BLUETOOTH=0'
      ]

    end
  end
end

 

1-1. Podfile 설정하려고 하는데 헷갈린다면..?  이 표를 참고해서 설정해주면 된다!

Info.plist에 설정한 값과 permission handler로 줄 pod config 값을 잘 확인해주면 된다.

| Permission                        | Info.plist                                                | Macro                        |      |
| --------------------------------- | --------------------------------------------------------- | ---------------------------- | ---- |
| PermissionGroup.reminders         | NSRemindersUsageDescription                               | PERMISSION_REMINDERS         |      |
| PermissionGroup.contacts          | NSContactsUsageDescription                                | PERMISSION_CONTACTS          |      |
| PermissionGroup.camera            | NSCameraUsageDescription                                  | PERMISSION_CAMERA            |      |
| PermissionGroup.microphone        | NSMicrophoneUsageDescription                              | PERMISSION_MICROPHONE        |      |
| PermissionGroup.speech            | NSSpeechRecognitionUsageDescription                       | PERMISSION_SPEECH_RECOGNIZER |      |
| PermissionGroup.photos            | NSPhotoLibraryUsageDescription                            | PERMISSION_PHOTOS            |      |
| PermissionGroup.notification      | PermissionGroupNotification                               | PERMISSION_NOTIFICATIONS     |      |
| PermissionGroup.mediaLibrary      | NSAppleMusicUsageDescription<br />kTCCServiceMediaLibrary | PERMISSION_MEDIA_LIBRARY     |      |
| PermissionGroup.sensors           | NSMotionUsageDescription                                  | PERMISSION_SENSORS           |      |
| PermissionGroup.calendar          | NSCalendarsUsageDescription                               | PERMISSION_EVENTS            |      |
| PermissionGroup.location          | NSLocationAlwaysAndWhenInUseUsageDescription              | PERMISSION_LOCATION          |      |
| PermissionGroup.locationAlways    | NSLocationWhenInUseUsageDescription                       | PERMISSION_LOCATION          |      |
| PermissionGroup.locationWhenInUse | NSLocationUsageDescription                                | PERMISSION_LOCATION          |      |

 

2. flutter clean / flutter pub get / pod install

프로젝트 설정을 리셋해주고,
build version 올려서 다시 Project > Archive > upload 하면 메일 없이 (ㅠㅠ) 정상적으로 앱 스토어 커넥트에 등록 되는 것을 확인 할 수 있다!