If your app integrates AppTrackingTransparency, please indicate where in your app we can find the AppTrackingTransparency permission
Guideline 2.1 - Information Needed
We're looking forward to completing the review of your app, but we need more information to continue. Specifically, we noticed that your app uses the AppTrackingTransparency framework, but we haven't been able to locate the relevant AppTrackingTransparency permission requests.
While it is not required to implement AppTrackingTransparency at this time, we check to make sure the implementation is compliant with our guidelines when we detect the framework in an app.
Next Steps
If your app integrates AppTrackingTransparency, please indicate where in your app we can find the AppTrackingTransparency permission request.
If your app does not integrate AppTrackingTransparency, please indicate this information in the Review Notes section for each version of your app in App Store Connect when submitting for review.
권한 상태는 undetermined,granted,denied,restricted 가 있으며 안드로이드는 추가로permanentlyDenied 가 있다.
예를 들어 카메라 권한 상태가 궁금하면 Permission.camera.status 로 확인하면 된다.
var status = await Permission.camera.status;
if (status.isUndetermined) {
// We didn't ask for permission yet.
}
// You can can also directly ask the permission about its status.
if (await Permission.location.isRestricted) {
// The OS restricts access, for example because of parental controls.
}
권한 요청
아래와 같이 Permission.contacts.request() 로 요청하면 된다.
return 값은 undetermined,granted,denied,restricted 와 같은 값이다.
if (await Permission.contacts.request().isGranted) {
// Either the permission was already granted before or the user just granted it.
}
// You can request multiple permissions at once.
Map<Permission, PermissionStatus> statuses = await [
Permission.location,
Permission.storage,
].request();
print(statuses[Permission.location]);
사용예시
실제로 사용할 때는 await 가 있기 때문에 async 로 감싸진 클래스(또는 함수) 에서 다뤄야 한다.
위젯 생명주기중 하나인 initState 에서는 Future 클래스가 호출이 안된다.
이럴때는 WidgetsBinding.instance.addPostFrameCallback((_) { 요기 } 에다가 넣어주면 된다.
아래와 같은 함수를 만들어놓고 불러오면 된다.
여기서 카메라 권한 확인용으로 만든 camPermissionIsGranted 변수를 사용했다.