这是一个裸反应的原生项目。
我正在使用的代码:
import * as unimodules from 'react-native-unimodules';
// ...
unimodules.Permissions.getAsync(unimodules.Permissions.LOCATION)
.then(console.info)
.catch(console.error)
; package.json 中的版本
"react-native-unimodules": "^0.7.0",
在纱线锁
expo-permissions@~8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/expo-permissions/-/expo-permissions-8.0.0.tgz#5a45e8451dd7ff37c9e6ce5e2447818372547813"
integrity sha512-GHTRmwh1rd1b0FcibluPFu93NNQyl9b1anBBDVPmomoo9Prz7kDcO5p2hFqM99r896yvAUSe0fPloPKUq4g/1A==
save error about some other permission type (Permissions.NOTIFICATIONS works fine, while Permissions.CAMERA does not)
所以我开始检查代码。权限列表在这里定义
https://github.com/expo/expo/blob/master/packages/expo-permissions/src/Permissions.ts#L28。它是一个列表。
[self registerRequesters:@[userNotificationRequester, remoteNotificationRequester]];
仅用于通知。因此,该代码意味着getAsync
仅适用于Notifications
. 这是真的吗?我什至不明白如何向世博团队报告这个问题。
PS我的环境:
Expo CLI 3.11.3 environment info:
System:
OS: macOS 10.14.6
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.14.0 - ~/.config/nvm/12.14.0/bin/node
Yarn: 1.21.1 - /usr/local/bin/yarn
npm: 6.13.4 - ~/.config/nvm/12.14.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.6010548
Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild
npmPackages:
@types/react-native: ^0.60.22 => 0.60.22
react: 16.9.0 => 16.9.0
react-native: 0.61.5 => 0.61.5
react-navigation: ^4.0.10 => 4.0.10
npmGlobalPackages:
expo-cli: 3.11.3