简体   繁体   English

如何知道 iOS 用户是否拒绝了 react-native 的许可?

[英]How to know if iOS user declined permission or not on react-native?

I have an app that requires camera access.我有一个需要相机访问权限的应用程序。 On android side I am asking for permission but on iOS side you don't have to request permission because Apple do it for you (from plist).在 android 方面,我要求许可,但在 iOS 方面,您不必请求许可,因为 Apple 为您做(来自 plist)。 But in that case I don't know if iOS user accepted or rejected the permission request.但在那种情况下,我不知道 iOS 用户是接受还是拒绝了权限请求。 How can I know user is accepted request or not on iOS device.我如何知道用户是否在 iOS 设备上接受了请求。

If user will decline the permission I will navigate to other screen and if accepted camera will open.如果用户拒绝许可,我将导航到其他屏幕,如果接受,相机将打开。

I didn't find any answer on stackoverflow or react-native documentation.我没有在 stackoverflow 或 react-native 文档中找到任何答案。

Thanks in advance.提前致谢。

You could use permissions library to ask for permission, and store whether you already asked it in the device local AsyncStorage.您可以使用权限库请求权限,并将您是否已经请求权限存储在设备本地 AsyncStorage 中。

I am not sure it is possible to tell whether they've rejected some permissions from the OS.我不确定是否可以判断他们是否拒绝了操作系统的某些权限。

An unified permissions API for React Native on iOS and Android.适用于 iOS 和 Android 上的 React Native 的统一权限 API。

https://github.com/yonahforst/react-native-permissions https://github.com/yonahforst/react-native-permissions

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM