赞
踩
React Native请求用户权限
Request user permissions from React Native, iOS + Android
参考链接:https://www.npmjs.com/package/react-native-permissions
一、如何使用
1.1 添加组件库:npm install --save react-native-permissions --- or --- yarn add react-native-permissions
1.2 连接原生库:react-native link react-native-permissions
1.3 iOS端初始化内库:In the XCode's "Project navigator", right click on your project's Libraries folder ➜ Add Files to <...>
1.4 iOS端加载组件库:Go to node_modules
➜ react-native-permissions
➜ selectReactNativePermissions.xcodeproj
1.5 iOS端加载内库: Add libReactNativePermissions.a
to Build Phases
-> Link Binary With Libraries
1.6 Android端现在在Android上使用React Native自己的JS PermissionsAndroid模块,不再需要在Android上做任何额外的连接
AndroidManifest.xml
for android and Info.plist
for iOS (Xcode >= 8). See iOS Notes or Android Notes for more details. - // example
-
- Permissions.check('location', { type: 'always' }).then(response => {
- this.setState({ l
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。